Example #1
0
void InnerWalls::Create()
{
	PxRigidStatic* rgd = PHYSICS->createRigidStatic(m_pose);
	
	Board* b = const_cast<Board*>(P::board);

	// Determine Poses
	Transform p_pLaneWall, p_pLaneWallTp, p_pLaneWallExt, p_fWallLft, p_fWallRgt;

	p_pLaneWall		= Transform(b->Right()	+ Vec3(b->PlungerLaneWidth() + (m_width*4), 0, b->Bottom().z+m_geometrys[IW_ID_PLUNGE_LN_WALL].box().halfExtents.z));
	p_pLaneWallTp = Transform(b->Top() - Vec3(m_width * 2, 0, (b->PlungerLaneWidth() * 3) + (m_width * 6)));

	// Create Shapes
	PxShape* pL		   = rgd->createShape(m_geometrys[IW_ID_PLUNGE_LN_WALL].box(), *m_material); // Plunger Lane Wall
	PxShape* PlT	   = rgd->createShape(m_geometrys[IW_ID_PLUNGE_LN_WALL_TP].box(), *m_material); // Plunger Lane Wall Top

	// Set Local Poses
	pL->setLocalPose(p_pLaneWall);
	PlT->setLocalPose(p_pLaneWallTp);

	// Set Global Pose
	rgd->setGlobalPose(P::board->Pose() * Transform(0, m_height*2, 0));

	m_actor.staticActor = rgd;

	m_actor.staticActor->userData = &m_color;
}
void MirrorActor::updatePose(const PxTransform &pose)
{
	if ( mMirrorActor )
	{
		if ( mMirrorActor->getType() == PxActorType::eRIGID_STATIC )
		{
			PxRigidStatic *p = static_cast< PxRigidStatic *>(mMirrorActor);
			p->setGlobalPose(pose);
		}
		else
		{
			PxRigidDynamic *p = static_cast< PxRigidDynamic *>(mMirrorActor);
			p->setKinematicTarget(pose);
		}
	}
}
Example #3
0
void Border::Create()
{
	PxRigidStatic* rgd = PHYSICS->createRigidStatic(m_pose);
	
	Board* b = const_cast<Board*>(P::board);

	// Determine Poses
	Transform p_top, p_bottom_lft, p_bottom_rgt, p_left, p_right;
	p_top =			Transform(b->Top()	  - Vec3(0,0,m_width));
	p_bottom_lft =  Transform(Vec3(b->Left().x - m_geometrys[BDR_ID_BTM_LFT].box().halfExtents.x, 0, b->Bottom().z));
	p_bottom_rgt =  Transform(Vec3(b->Right().x + m_geometrys[BDR_ID_BTM_RGT].box().halfExtents.x + b->PlungerLaneWidth() + m_width*3, 0, b->Bottom().z));
	p_left	 =		Transform(b->Left()	  - Vec3(m_width, 0, 0));
	p_right  =		Transform(b->Right()  + Vec3(m_width, 0, -m_width));

	// Create Shapes
	PxShape* sT = rgd->createShape(m_geometrys[BDR_ID_TOP].box(), *m_material);
	PxShape* sBl = rgd->createShape(m_geometrys[BDR_ID_BTM_LFT].box(), *m_material);
	PxShape* sBr = rgd->createShape(m_geometrys[BDR_ID_BTM_RGT].box(), *m_material);
	PxShape* sL = rgd->createShape(m_geometrys[BDR_ID_LFT].box(), *m_material);
	PxShape* sR = rgd->createShape(m_geometrys[BDR_ID_RGT].box(), *m_material);

	// Set Local Poses
	sT->setLocalPose(p_top);
	sBl->setLocalPose(p_bottom_lft);
	sBr->setLocalPose(p_bottom_rgt);
	sL->setLocalPose(p_left);
	sR->setLocalPose(p_right);
	
	// Set Global Pose
	Transform t = const_cast<Board*>(P::board)->Get().staticActor->getGlobalPose();
	rgd->setGlobalPose(P::board->Pose() * Transform(0, m_height*2, 0));

	m_actor.staticActor = rgd;

	m_actor.staticActor->userData = &m_color;
}