Gravity enable/disable with CheckBox?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
PsycoDad
Posts: 36
Joined: Mon Jan 09, 2006 8:30 am
Location: Munich/Germany

Gravity enable/disable with CheckBox?

Post 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
Wer andern eine Bratwurst brät, der hat ein Bratwurstbratgerät!
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post 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.
Image Image Image
PsycoDad
Posts: 36
Joined: Mon Jan 09, 2006 8:30 am
Location: Munich/Germany

Post 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
Wer andern eine Bratwurst brät, der hat ein Bratwurstbratgerät!
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post 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
Image Image Image
PsycoDad
Posts: 36
Joined: Mon Jan 09, 2006 8:30 am
Location: Munich/Germany

Post 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
Wer andern eine Bratwurst brät, der hat ein Bratwurstbratgerät!
aguilmet
Posts: 8
Joined: Sun Feb 18, 2007 8:08 pm

Post by aguilmet »

The thing I don't get is how you access setGravity
monkeycracks
Posts: 1029
Joined: Thu Apr 06, 2006 12:45 am
Location: Tennesee, USA
Contact:

Post by monkeycracks »

animator->setGravity(...);

?
Post Reply