Getting the distance between the Player and the Floor

hoffhoff

06-07-2006 21:28:33

Hello,
I´m trying to create a floating craft in my game. So, I´ll have to apply a force on Y axis to make it float. This force is proportional to the distance between the craft and the floor.
So, how´s the best way to calculate that distance? I read some math books and examples, but I´m still having problems to understand quaternations =~

Also, have anyone ever created some game with spaceships, helicopters or things that flies? Because when it is floating, there is no fricticion, so if you aply some force for movement, it will keep moving even after you release the button. Well, I created a function that applies forces to stop the movement of the body when no key is being pressed. Is that the best way to do this?

Thanks!

OvermindDL1

06-07-2006 22:23:04

Floating: if the floor is always in the negative Y direction from the craft, just trace straight down and get the distance. Quat's are not needed.

Flying: Yep, apply a reverse motion when key is released.

hoffhoff

08-07-2006 14:27:42

Ok
And how can I get the direction of the movement, to apply a force against it?
That´s breaking my brain =~

OvermindDL1

09-07-2006 05:32:52

@lookat OgreNewt::Body::getVelocity

As for the formula you need, is is somewhere on these forums...

hoffhoff

09-07-2006 21:32:48

I got it working
Thank you ppl!

I´m still havimg problems to set the collision with terrains, but I think that I found the solution in other post too.