try TestAdvancedVehicle and Tutorial Lesson8 and Lesson8b, to start with
(in jmephysics: test-interactive folder)
you can nearly overtake the hole code from TestAdvancedVehicle, you just have to set the wheels invisible(change their material to ice) and add jumping code from Lesson8 and "bingo", you have your Hovercraft
You wouldn't need an invisible soft thing underneath it… just let it hover a set distance above the height map and then add a method to let it randomly move up and down a bit so it appears to hover.
It depends on what kind of obstacles your hovercraft may run into. I'm working on a hovercraft game as well, and found that using 'invisible' objects would lead to complications if your invisible objects hit something in mid air (say, if you were in mid jump). also, i'm sure you'd need to find a way to stay right side up in most cases, right?
I attempted something similar to that approach, but what ended up happening was if the hovercraft ever went on a slight ramp, it would push one way more and would quickly topple. Again, if you kept it from rotating too far off it's axis, that may work fine :).
I attempted something similar to that approach, but what ended up happening was if the hovercraft ever went on a slight ramp, it would push one way more and would quickly topple. Again, if you kept it from rotating too far off it's axis, that may work fine :).
I don't know how you'd account for it in the physics library since I've never used it, but I thought I'd point out that the jets of air from a hovercraft become less powerful (lift wise) the further you are from the ground - so it would be almost impossible to tip one like that in real life. I'm not sure if there is some way to emulate a reduction like that without a lot of extra coding though.
I don't know how you'd account for it in the physics library since I've never used it, but I thought I'd point out that the jets of air from a hovercraft become less powerful (lift wise) the further you are from the ground - so it would be almost impossible to tip one like that in real life. I'm not sure if there is some way to emulate a reduction like that without a lot of extra coding though.
The force emitted from your jet points could be a function of the distance that point is from the ground. That way if say a corner of the craft goes over say, a rock, then more force would be applied at that point and it should rise up some. If the craft is moving and the ground drops out from under it, then the force would be reduced and the craft would be pulled down by gravity until it became close to the ground again. Or something like that.
I suppose it would just require a bit of tweaking. If you changed the values too much, then the jets would turn on and off too intermittently to keep the ship stable… if you changed the values too much, however, you would overshoot and the stability would quickly deteriorate. Remember, you have to put into account this hovercraft would have some inertia :).
Now, if you did this right (which I would love to see!) then you might get a cool wobbly effect, making it really look like it is 'hovering'.
You know, if you run into stability issues, you may be able to implement a faux 'air friction' on the ship to keep it from wobbling too much, not sure if that would help.
velocForward = 28.5
velocReverse = 20.0
velocStrafe = 16.0
accelThrust = 24.0 //acceleration
accelDragStop = 6.0 //how fast it stops once hands are off controls
accelJump = 15.0
setAltitude = 1.0 // how high off the ground
alphaTrack = 21.0 //springs speed it rights itself
alphaDamp = 8.0 //shocks
pitchPitch = 0.25 //nose up, how much the nose tilts up and down when you move the mouse when you're just sitting on the ground.
pitchThrust = 0.1 //nose down, how much the nose tilts down when you step on the gas.
rollStrafe = 0.08 //rolls while strafing
omegaSpin = 6.0 //spinning in place speed, how fast you spin while standing still.
omegaTurn = 2.3 //turning while moving speed, how fast you turn while moving.
alphaSteer = 7.0 //how fast it responds to steering
rollSteer = 0.08 //rolls while steering, how much it rolls while moving and steering.
Now, I just gotta find a way to implement that :) Any thoughts?
I was thinking about starting off with just a simple box, trying to simulate those physics. What do I need?
Ok, I have added this box into the game and I've mapped a key that is supposed to be the forward-thrust key.
What I'm wondering next is how to apply this thrust to this box, sitting on a terrain. I can do ship.addForce(…), but doesn't do anything unless I change the force to a high value, and then the box just goes up in the air and off the map.
I'm starting to think I'm thinking this all wrong.
Applying forces is the only way I know how to move said objects in a physics style, however if you set the correct location of the center of mass and toy around with materials you should be able to get the game to play smoothly.
You could simply take the distance from the hovercraft to the floor and use this value to modify the force which pushes the craft upwards.
So you could create a physicsCallback with two nodes and a few modifier values and thus create your inverted magnet which pushes one object away from the other.