Page 1 of 1
Gravity
Posted: Wed May 15, 2013 9:08 am
by mohammadAdnan
Hello , Norbo I am trying to make some gravity points in the sky ( as game play ) which grab the player toward it when he is flying , those acts as gravity points in the sky and they will grab the player if he is close to them
Q : How to make those Gravity points Norbo?
Re: Gravity
Posted: Wed May 15, 2013 6:35 pm
by Norbo
A GravitationalField, one of the demos force fields, would do the trick. You may want to use a BoundingSphereForceFieldShape for the shape rather than an InfiniteForceFieldShape, though. Check out the PlanetDemo for an example.
Re: Gravity
Posted: Wed May 15, 2013 8:27 pm
by mohammadAdnan
thanks Norbo I found PlanetDemo.cs and I can't found the first one, for the Thurster class it seems that you made changes to the latest BEPU engine , so how to get it in the new version ?
Code: Select all
var thruster = new Thruste(ship, new Vector3(0, -2, 0), new Vector3(0, 300, 0), 0);
Space.Add(thruster);
this gives errore
Re: Gravity
Posted: Wed May 15, 2013 9:24 pm
by Norbo
The Thruster is just an example class contained in the BEPUphysicsDemos.
Re: Gravity
Posted: Thu May 16, 2013 2:33 pm
by mohammadAdnan
Thanks Norbo , while I am thrown away due to Gravity field , how to check how far I am from the ground ?? ( Suppose I am flying after shocked by the gravity field and now I am in the air far from the ground Ok Nobo !! )
Re: Gravity
Posted: Thu May 16, 2013 7:53 pm
by Norbo
If the ground can be considered a single flat plane, or if altitude can be considered from some fixed reference point like sea level, then you can just subtract the 'ground' height from the height of the character (usually the entity.Position.Y, unless you're using a different axis interpretation).
If you don't know the ground's height, you could send a ray cast in the down direction to find it.