Hover craft like physics?
Hover craft like physics?
Does any one have any good links or resources on how to set up hover craft like physics? I don't need it to go too in depth or deep into formulaes as I'll be using Newton physics. Or if anyone knows a good way to do hover physics themselves that would be great...I'm not asking for code, just the theory behind it.
-
- Posts: 83
- Joined: Wed May 23, 2007 6:11 pm
Dorth wasnt suggesting that your hover craft is a boat but instead that the way a water bound vessel moves can be very similar in some aspects to how a hovercraft moves.
Guerilla Softworks
New Guerilla Softworks website under construction - http://guerillasoftworks.awardspace.com
New Guerilla Softworks website under construction - http://guerillasoftworks.awardspace.com
you have to apply force to the bottom of hovercraft. to keep it in the same height you should apply force and lift it unless you are at required height, when you dont need to go up - do not apply force. When you fall lower than you need - lift hovercraft again. to get height from ground you will need to cast a ray downwards. for better stability of craft you will have to apply force to several points of craft. this will keep balance. and cast a ray from each point of applying force, so you will know when you will need to lift up specific part of craft. i hope it helps
Ok...To do that I would need to use a Raycast, right? I've been searching the API for ages looking for a raycast, but can't seem to find it. If someone could post the syntax or a link to the docs for it I would be very grateful.
Btw, I know newton has it's own raycast, but it doesn't seem to work with tree collisions, which is what my terrain is :\.
Btw, I know newton has it's own raycast, but it doesn't seem to work with tree collisions, which is what my terrain is :\.
oh crap. I'm so sorry. I meant the collision tutorial. Here I'll snatch the code to make up for my blunder.
Thats almost pasted out of the collision tutorial directly.
The nomalize thing doesn't have to be used... thats just because the angle of the camera is being used. really they are just two 3d points..
Again, really sorry
Code: Select all
core::line3d<f32> line;
line.start = camera->getPosition();
line.end = line.start +
(camera->getTarget() - line.start).normalize() * 1000.0f;
core::vector3df intersection;
core::triangle3df tri;
if (smgr->getSceneCollisionManager()->getCollisionPoint(
line, selector, intersection, tri))
{
//if the line hit something code goes here
}
The nomalize thing doesn't have to be used... thats just because the angle of the camera is being used. really they are just two 3d points..
Again, really sorry
I used Roxaz method for this. For stability a small force is applied (constantly in each update) above the centre of gravity (at the top of the craft) to keep it upright.
However with that method the hovercraft bounces in the air a lot. So if you just want something that slides just above the ground, set the friction very low as Dances suggests.
However with that method the hovercraft bounces in the air a lot. So if you just want something that slides just above the ground, set the friction very low as Dances suggests.