Jump to content

  • Log In with Google      Sign In   
  • Create Account


Inclined slope travelling under gravity


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Jedaye   Members   -  Reputation: 122

Like
Likes
Like

Posted 20 August 2001 - 11:37 PM

Hi, I am trying to encapsulate some physics into my collision resolution but am having the following problem: I have a player (human) model walking around a map (imagine a 1st person shooter). It is colliding with all pollys (walls and floor) and resolving a new velocity via: *vel -= CollidedNormal * DotProd(vel, &CollidedNormal); Where CollidedNormal is the normal of the poly it collided with. Gravity is added to the velocity initially to keep the player ''on the floor''. The slidding along walls is fine however when the player tries to walk up a slope of any real gradient he/she ends up slowing to a stop on the slope. Can anyone throw some light on how I might go about fixing this so the player can slide along walls and walk up slopes?? Thanks in advance ** Ste

Sponsor:

#2 JOL   Members   -  Reputation: 160

Like
Likes
Like

Posted 20 August 2001 - 11:49 PM

just an idea...
is your movement a force like the gravity ?
your movement should be a force along the poly you are walking on....
as I said ... just a thought


#3 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 21 August 2001 - 12:57 AM

Well, the position is an applied update of vel + gravity vectors...if thats what you are asking...

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...

#4 Jedaye   Members   -  Reputation: 122

Like
Likes
Like

Posted 21 August 2001 - 05:50 AM

Decrease the gravity and i can walk up slopes oki (sliding is fine also) but with a higher, more realistic gravity, i just cant walk up slopes (altho sliding down them is more realistic with a modest gravity value)

#5 icecode   Members   -  Reputation: 122

Like
Likes
Like

Posted 21 August 2001 - 09:08 AM

In my game I do this:

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...

icecode

#6 AndyMan   Members   -  Reputation: 148

Like
Likes
Like

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.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS