Hello. I am currently working on an implementation of a physics viewer
application that utilizes openscenegraph and Ageia PhysX (to control the
bodies in the simulation). So far my implementation is as follows. The root
node is a group node. I load my model graphic file up and attach it to a
position attitude transform node which I then attach to the root node. For
every step of the physics simulation, I get a position vector and a quad
from PhysX which I then apply to the PAT. The issue that I am experiencing
is that it appears that when I attempt to update both position and rotation
the models do not act properly. It is almost as if I am rotating the PAT
instead of the model.

Here is a simple example of what I am doing:
//standard calls to viewer. members
//Update physics simulation update
(inside render loop)
   NxActor** PhysicsActors = gPhysicsScene->getActors();
   NxVec3 PhyPos;
   NxQuat PhyRot;
   PhyPos = (PhysicsActors[1])->getGlobalPosition();
   PhyRot = (PhysicsActors[1])->getGlobalOrientationQuat();
   osg::Node* GraphicsActor = gRoot->getChild(0); //In this example, only
rotate the first object..

dynamic_cast<osg::PositionAttitudeTransform*>(GraphicsActor)->setPosition(osg::Vec3d(
PhyPos.x, PhyPos.y, PhyPos.z));
   osg::Quat GraphRot;
   GraphRot.set( static_cast<osg::Quat::value_type>(PhyRot.x),
static_cast<osg::Quat::value_type>(PhyRot.y),
                       static_cast<osg::Quat::value_type>(PhyRot.z),
static_cast<osg::Quat::value_type>(PhyRot.w));

dynamic_cast<osg::PositionAttitudeTransform*>(GraphicsActor)->setAttitude(
GraphRot);
(end of render loop)

If anyone is familiar with both of these systems, and wouldn't mind
explaining what I am doing wrong, I would be very grateful.


Mike Bosse'

--
"It is only necessary to make war with five things: with the maladies of the
body, with the ignorances of the mind, with the passions of the body, with
the seditions of the city, with the discords of families." - Tacitus

"The desire for safety stands against every great and noble enterprise." -
Tacitus

"Those who would give up essential liberty to purchase a little temporary
safety deserve neither liberty nor safety." - Benjamin Franklin
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to