Got a line and a Direction, angle of rebound?
Ok, I''m sure I should be able to figure this out, but 3 hours later I''m still stuck. (this is all 2D)
I have a line segment formed from PointA and PointB. I have an Objected heading in a direction Vector (I also have the angle). I can tell if the two collide but I''m having trouble determining the angle and therefore the vector the object takes after the collision. Thanks guys.
ScrewWorkn
February 06, 2002 08:48 AM
ok, I hope you know the intersection point, if you know that try this:
calculate the angle between your plane (p) and your velocity vector (v), (cos(angle)=p dot v / |v||p|), the rotate your velocity 2 times that angle (think of p as a mirror and v as light). I think that should work..
calculate the angle between your plane (p) and your velocity vector (v), (cos(angle)=p dot v / |v||p|), the rotate your velocity 2 times that angle (think of p as a mirror and v as light). I think that should work..
quote:
Original post by Anonymous Poster
ok, I hope you know the intersection point, if you know that try this:
calculate the angle between your plane (p) and your velocity vector (v), (cos(angle)=p dot v / |v||p|), the rotate your velocity 2 times that angle (think of p as a mirror and v as light). I think that should work..
Ok, I know I should know this but to clarify. How do I get the dot of p and v, and how do I multiply |v| and |p|. When you say velocity vector is v, is that the angle that the object is moving at. What format is p specified in? I can just use a line since I''m working in 2D right? Sorry I''m very new to this stuff.
if p = {px, py} and v = {vx, vy} then:
p dot v = (px*vx)+(py*vy)
and
|p|*|v| = sqrt(px² + py²) * sqrt(vx² + vy²)
the || simply mean that you should use the lenght/absolute value
My post up, your post down, my site here
p dot v = (px*vx)+(py*vy)
and
|p|*|v| = sqrt(px² + py²) * sqrt(vx² + vy²)
the || simply mean that you should use the lenght/absolute value
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement