How to make things "float"

Alexisfire

10-11-2010 21:57:14

Hi!
I'm actually working on a small project for my university, what i've to do is a little game where i drive a floating car.
The question is...how should i implement the floating parameter?

Any idea? Actually i'm trying with the PlayerController Class...but i'm not sure, the rayCastVehicle also don't seem the right choise but maybe i'm wrong.

Any help would be really appreciate :)

Thanks!

Alex

Sjinta

11-11-2010 11:04:42

I have no idea, but there is a demo on boyancy, i would look there if i were you.

Alexisfire

12-11-2010 10:31:56

Thnx for the try.
I've checked the buoyancy demo, but, from what i've understood with the buoyancy you can only simulate how items float on a liquid, in my game i've a track with climbs and falls(like F-zero game), so i don't know if i could use buoyancy for this.

Am I wrong?

*Edit*
From Newton forum

Looks a lot like a raycast car with no tires.

Going to try right now

mvelazquezm

02-12-2010 10:51:41

An idea.

Make 2 meshes. One for the physics effects that will be hidden (I think that this is like you did with tires), and the second (visible) and linked to the first in a position several points up in Y axis. Then while your car moves, you can move up and down your "visible" car to make and floating effect. And when your car turns, you can pitch the "visible" car.

Some like this (this code is invented, only an approchement):

Ogre::Entity* carPhysics;
....
.........

carPhysics->setVisible(false);
OgreNewt::ConvexCollisionPtr col....... -> adding physics to carPhysics......OgreNewt::Body* carPhysicsBody........

...........

Ogre::Entity* carVisible;
............
Ogre::SceneNode* carRoot = mSceneMgr->getRootSceneNode()->createChildSceneNode("carRoot",Ogre::Vector3(0, 0, 0));
Ogre::SceneNode* car = carRoot ->createChildSceneNode("car",Ogre::Vector3(0, 5, 0));
...............
car->attachObject(carPhysicsBody);
carPhysics->getBody0()->attachNode(carRoot );



alexisfire, I sent you a mail yerterday.....

majc

09-02-2011 11:41:57

Or in your object force callback you can add a positive gravity enough to make it float, I never tried it's only a theory.