Advertisement

Collision detection

Started by June 07, 2016 11:14 AM
14 comments, last by adriansnetlis 8 years, 8 months ago

http://web.stanford.edu/class/cs277/resources/papers/Moller1997b.pdf

In this article in equation 3 there is a variable O which I am unsure - what is it? How do I obtain it?

Also in those equations - does the dot refer to multiplication or dot product?

>>

  • If the vertex is colliding with surface

formula to use: "distance from a point to plane".

get the distance before you move, and after you move. if the sign of the distance (pos vs neg) has changed, you've passed though the plane. if the distance is exactly zero, the point lies in the plane.

>>

  • How deep the vertex has gone through the surface in case if it is colliding

this is just the distance to the plane after moving, when you have passed though the plane. so you've already calculated it by then. just use the result from the "did i pass though the plane ?" test.

>>

  • How much force and in which direction the vertex needs to have applied in order get on the surface

while travelling the shortest distance to the plane?

as i recall, you take any three points on a plane and do the cross product of their two vectors to get the normal to the plane - basic analytic geometry.

the amount of force required would depend on the current position, velocity, and acceleration of the body.its unlikely that application of a single impulse (a finite acceleration for a small finite time) could move the point into the plane and make it come to rest without deceleration or dampening from the system being modeled (you mentioned springs).

>> Actually what I really need is to find out the normal force of contact

Fnorm = proj(Fdir) along normal axis. basic rectilinear kinematics.

and Fdir = MV. basic physics - impulse and momentum.

so the force in the direction of travel is the mass of the object times its velocity. otherwise known as momentum.

you then take the projection of that direction vector along the normal axis of the plane. basic vector math.

the projection of one vector onto the axis of another is the length of the vector times the cosine of the angle between the vectors.

(does't anybody take analytic geometry, vector math, physics, and mechanics anymore?)

so Fnorm = M*V*cos(theta), where theta is the angle between the direction of travel and the normal of the plane.

pretty damn simple huh? that's why i love physics and hate math. <g>.

so now you have the force in the normal direction, and from the line segment between the "before i moved" and "after i moved" points, you have the point of intersection with the plane (i'm not going to look up all the formulas, that's on you or the math junkies here to post them for you).

once you have your force and point of intersection you should really switch to rigid body modeling of motion of the entire body, but if you just want to calculate the distributed force at the the triangle verts:

Ftotal = Fnormal

D1,D2,D3 are the distance from the point of intersection to the three vertices of the triangle.

calculate D1,D2,and D3 using the "3d distance between 2 points" formula.

then:

Dtotal = D1+D2+D3

and Ftotal is just Fnormal.

F1 = Ftotal*(Dtotal-D1)

F2 = Ftotal*(Dtotal-D2)

F3 = Ftotal*(Dtotal-D3)

and F1+F2+F3 should equal Ftotal, which is equal to Fnormal.

that's pretty much all there is to it.

at least as i recall off the top of my head.

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

Advertisement

Hm... This vertex stuff is useful. However, the surface is limited. It's triangle. I need to find out if vertex passed through triangle, not infinite plane.

My final decision - I'm gone use a line/plane intersection. The line is 4D representation of 3D point. The 2 points of line are current prosition and previous position of vertex. The line joins them(assumes linear motion, this is accurate enaugh in high frequencies). This will allow to accurately detect any collision that the vertex makes. The articles have line/triangle intersection, but they don't seem to have line/triangle prisma intersection. It's for a case of moving collision surface. Or maybe I could skip this case?

if you have line triangle you can get line prism by testing the line against each of the 8 triangles making up the prism (1 for each end, 2 for each side)

Hm... This will work, that's for sure. Unless... Unless the line is inside the triangle. However, in this case the vertices of the triangle which moves(making the prism) will detect it.

The problem with this might be the performance. But, hopefully, it'll perform well enaugh. I'll try implementing it;)

What I can do for sure is to use triangles on static objects, rather than prisms, as those objects don't move anyways.

This topic is closed to new replies.

Advertisement