door with frame started funtion

satchigi

03-07-2011 22:50:02

What should i do if I want to affect some force on
ridged body(door) in FrameStarted funtion? (not CreateScene or etc)

I just want to set on/off setMassMatrix in certain condition by using 'if' sentence.
but I get error when I put down any ridged body stuff on the frame started funtion.(include setMassMatrix)

what I exactly want is Make the door firmly locked before certain condition like,
when character reach the door, 'space = open door' text comes up, and push space, then door open. and close automatically after seconds.


is there any other method to lock movement of door before certain condition?

plz help anyone!

Lax

24-07-2011 21:20:22

I would create a door joint (OgreNewt::Hinge), set the Doorbody's type to an index maybe enumerator DOORTYPE and call setLimits(Ogre::Radian(0), Ogre::Radian(0));
Later in an updatefunction execute an raycast and test of the DOORTYPE. Like:

if (contact.mBody)
{
if (contact.mBody->getType() == DOORTYPE)
{
getJoint of the door body //maybe you need to safe e pointer, that this joint belongs to the door
joint->enableLimits(false);
...