Esempio n. 1
0
//
//	ESciVis::CreatePhysMesh
//
NxActor *ESciVis::CreatePhysMesh( IPxTriMesh mesh, const EVec4 &pos, const EQuat &orient, float mass )
{
	NxVec3	p	=	ToNxVec3( EVec3(pos.x, pos.y, pos.z) );
	NxQuat	q	=	ToNxQuat( orient );
	
	//	actor descriptor
	NxActorDesc actor_desc;
	NxBodyDesc	body_desc;

	NxActor *actor = NULL;	

	//	setup actor shape :
	NxConvexShapeDesc shape_desc;
	shape_desc.meshData		=	BuildConvexMesh( mesh );
	shape_desc.localPose.t	=	NxVec3(0, 0, 0);
	shape_desc.group		=	0;
	actor_desc.shapes.pushBack(&shape_desc);

	ASSERT(shape_desc.isValid());

	//	setup actor :
	actor_desc.body			= &body_desc;
	actor_desc.density		= 0;
	actor_desc.globalPose.t	= p;	
	actor_desc.globalPose.M	= NxMat33(q);
	actor_desc.group		= 0;
	
	//	setup body :
	body_desc.mass			= mass;
	
	ASSERT(body_desc.isValid());
	ASSERT(actor_desc.isValid());

	//	create actor :
	actor = nx_scene->createActor(actor_desc);
	ASSERT(actor);
	
	return actor;	
}	
void PhysXShape::setLocalTranslation(const math::vector3d&v)
{
	m_nxShape->setLocalPosition(ToNxVec3(v));
}
// returns true if point is on node2
bool PhysXCylinderJoint::getLimitPoint(math::vector3d&p){
	return m_joint->getLimitPoint(ToNxVec3(p));
}
void PhysXCylinderJoint::setLimitPoint(const math::vector3d&p,bool pointOnNode2){
	m_joint->setLimitPoint(ToNxVec3(p),pointOnNode2);
}
//Sets the direction of the joint's primary axis, specified in global coordinates.
void PhysXCylinderJoint::setGlobalAxis(const math::vector3d &v){
	m_joint->setGlobalAxis(ToNxVec3(v));
}
bool PhysXCylinderJoint::addLimitPlane(const math::vector3d& normal, const math::vector3d & pointInPlane, 
	float restitution ) 
{
	return m_joint->addLimitPlane(ToNxVec3(normal),ToNxVec3(pointInPlane),restitution);
}
Esempio n. 7
0
	/// Sets a constant gravity for the entire scene. 
	virtual void SetGravity ( const Vector3 &vec ) { m_pScene->setGravity( ToNxVec3(vec) ); }