I’m trying to make a vehicle hover, to do this i have a mesh called “ground” and on the vehicle I have:
near sensor And motion
property: ground simple motion
distance: 0.5 force Z: 12 (non Local)
reset distance: 0.6
It doesn’t work though, as far as i can tell the near sensor isn’t triggering anything, can anyone see why?
Also it needs to stop triggering when it gets too high.
The rest of it is ok, as i swapped the near sensor with a keyboard sensor and it starts going up on the keypress fine
Or any ideas how you could make something hover?
Could be the ground is not an actor. Go into the ground’s physics tab, make sure “actor” is enabled, and give it a collision boundary (box, sphere, cone, etc.) if one isn’t set. Then, of course, make sure the game property name on the ground object is written exactly the same as that in the sensor… I know, stupid idea, but sometimes you might add a space on the end of one without realizing it… Just a slip of the finger.
Also, another way to make things hover: use a constraint actuator. Use “force field”, set up the force, axis, property, etc., and make sure “Persistent” is checked. You can then also use the Normals bit to make your hovering object level out if it gets tipped one way or the other.
For hovering you can use the physics setting of the materials.
Depending on how many hovering objects you have, it may become a problem using ‘near’ as too many near logic bricks might suck up CPU time.
To answer your last problem, to stop when things get too high, in logic you would need to have an inverted sensor brick that would trigger when it does not detect the track.
There are loads of ways of making things hover, each has its advantages/disadvantages. Its a matter of finding the one that works best for the situation. Here are some common ones:
1: Simple and dirty: parent your hovering object to an invisible mesh. If the mesh has a collision hull like capsule it should slide around nicely.
2: As monster suggests, use material physics. This option lives in the materials tab and is very tweakable.
3: Use the ‘distance’ constraint logic brick.
4: As amuddypizza suggests, use the force field constraint logic brick option.
5: (Python) use rays to detect the distance from the ground and add an upward force. Some people use more than one ray to stabilise the model and avoid excessive bouncing.
In this old test I did I use the distance constraint (option 3) mixed with a servo motion brick to allow antigravity looping, but it also keeps the hovering object a set distance from the ‘track’. To move press the up cursor.
One last thing: make sure you check the ‘align to normal’ option as this will make your model tilt to match the orientation of the polygon beneath it (that is if you want it this way!)
I hope this gives you some extra options. Any questions just ask- but if you do have a problem in future it helps us to help you by posting a simple .blend with the problem in so we may be able to fix things.
defy_gravity_logic.blend (460 KB)
Thanks very much for the suggestions and help, I used a distance constraint in the end with the ground object in the property field