• FEATURED

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

## sliding against wall

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.

4 replies to this topic

### #1norman_106  Members

Posted 07 August 2002 - 12:40 PM

I need help with some physics. How do I sliding against wall? Every time there is a collision detected I "stick" to the wall! I was trying to look this topic up in search engines with little results. However, I did come across some sites that suggested using dot product, vectors, and scalars. So I did a little research but I still don’t understand how these concepts are related to my main goal? Can anyone explain how to create the effect of sliding across a wall when there is a collision? Thanks, Norm

### #2Michalson  Members

Posted 07 August 2002 - 12:52 PM

### #3norman_106  Members

Posted 07 August 2002 - 04:23 PM

Actually this was one of the articles that found. I can’t get much from it. In the article it states:
Vt += Ni * (-dot(Ni,Vt)-Nd)

Where:
Vt = Desired Target or Destination of Player
Ni = Normal to the plane of impact
Nd = The "D" of the hit poly''s "plane equation"

Is Vt a vector object with X, Y, and Z properties? If not, then how do I convert Vt to get the objects new X, Y, and Z position? And I don’t know what they mean when they explain the value of Nd. Can someone explain or direct me to another article?

### #4mnansgar  Members

Posted 07 August 2002 - 05:21 PM

This is an interesting question ...

You should already have a vector where its magnitude is the player's velocity and its (x,y,z) are in the direction of the player's motion.

When you hit the wall, you need to find a second vector that is parallel to the wall: 1) Find two points at the same height on the wall (preferably the top two or bottom two of the wall's polys). 2) Find the vector between them: v = (p2.x-p1.x, p2.y-p1.y, p2.z-p1.z). 3) Find its unit vector and replace v with it.

Now we simply need to find the new vector of movement by projecting the current one onto the vector parallel to the wall: (dot product of u and v) * v. Using this method, the player will not lose his original velocity (he'll just move in a different direction).

1) Vt is a 3-dimensional vector.
2) Nd = 'd' in the following plane equation for the wall: ax + by + cz + d. The plane equation can be calculated by:

a) Finding 3 points on the plane.
b) Calculating vectors u and v from these, both vectors originating from the same point.
c) Finding the cross product of u and v (the plane's normal).
d) If the cross product = the vector (a,b,c), then the plane equation can be found by:
a(x-x1)+b(y-y1)+c(z-z1)=0. Thus, d = -a*x1 - b*y1 - c*z1.

I hope this helps!

[edited by - mnansgar on August 7, 2002 12:23:57 AM]

### #5MagTDK  Members

Posted 07 August 2002 - 05:45 PM