Inclined slope travelling under gravity,
Members - Reputation: 122
Posted 20 August 2001 - 11:37 PM
Posted 21 August 2001 - 12:57 AM
It will travel up lesser inclined clopes (say 30 degrees) but 45 degree or above it refuses to travel more than a short distance up...
Members - Reputation: 122
Posted 21 August 2001 - 09:08 AM
player.y-=0.3f (which would be 30 cm. in my game)
then I find out if the distance between the coordinates of the player and a face is less than 1.50f, and If it is, I push the player away 1.50f along the face''s normal. This way the speed at which the player slides down a slope depends on the steepness of the slope.. Another way is, which I am using now(better for shoot em ups), is to find out if the face is a wall or a floor, for example, if the steepness of the face is more than 45 degrees it''s a wall. if its a wall I use the same method as i described before, but if its a floor I dont push the player away along the normal of the face but up vertically. This is better for shoot em ups because you won''t slow down when walking up, which is very annoying. I hope this is what youre talking about...
Members - Reputation: 148
Posted 27 August 2001 - 12:50 AM
I tried to make my game with accurate physics like yours, and it took months, and it still isn''t right in some cases.
My game was in 2D, but the same rules apply. Gravity is applied to an object''s velocity every loop, and whenever there is a collision, it is resolved by changing the velocity in the direction normal to the colliding surface, as you said. I also change the velocity in the shear(?) direction, representing friction.
How does your player get its velocity in the first place? Whether you calculate it by friction or just by assigning it to a number, there will always be a slope too steep.
The physics here is not too complicated, but the problem for me was what I called "scraping problems". When you adjust the velocity after a collsion, the object should be sliding along the surface. But with rounding errors you might find that it''s still moving very slightly into the surface, and so you have a collision which can''t be resolved. Even having a velocity slightly away from the surface may not solve it, depending on the way you check for collisions.
If you want to handle multiple body problems, that gets more difficult again, as the simple 2-body rules will not solve them.
I can go into more detail here if you want, or you can email me. I have a lot of code (C++) which deals with moving objects and resolving collisions between them.