Page 1 of 1

Gravity enable/disable with CheckBox?

Posted: Wed Dec 13, 2006 2:30 pm
by PsycoDad
Hello everybody!

I Have a question!

I want to enable/disable the gravity in my program.
I make the gravity with this:
ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(MetaSelector, cameraFPS, vector3df(10,25,10), vector3df(0,-1,0), vector3df(5,5,5));
cameraFPS->addAnimator(anim);
anim->drop();
How can i change the value of the vector3df(0,-1,0), with a CheckBox?
guienv->addCheckBox(false,rect<s32>(90,10,105,25),tab2,-1);
Thx to all who will help me.
MfG PsycoDad

Posted: Wed Dec 13, 2006 3:59 pm
by JP
Each frame you could check the value of the checkbox and if it's false then you could remove any animators from the camera which would remove the gravity. you may then want the collision still there so you could then add a new animator with zero gravity. Similarly if the checkbox was true you'd just remove any old animators and add a new one which has the desired gravity.

Posted: Wed Dec 13, 2006 4:23 pm
by PsycoDad
Ok. Thx for you explanaition.

But how can i add or change the animator in the createCollisionResponseAnimator(); function?

Its mora a c++ problem for me!

I´m not able to change the vector3df(0,-1,0)

Hope for help. Greets PsycoDad

Posted: Wed Dec 13, 2006 5:53 pm
by JP
I've just looked at the API, more people seriously need to do this before posting their questions :P

ISceneNodeAnimatorCollisionResponse has a method called setGravity

Posted: Wed Dec 13, 2006 8:42 pm
by PsycoDad
Oh Thx. That was my problem.
It works.

Thx to JP

I´ll be back, with some other noob questions.
But next time i scan the API before. :D

Posted: Wed Feb 21, 2007 3:49 pm
by aguilmet
The thing I don't get is how you access setGravity

Posted: Wed Feb 21, 2007 10:24 pm
by monkeycracks
animator->setGravity(...);

?