Advertisement

Rotating vertices

Started by April 28, 2001 01:15 PM
0 comments, last by David20321 23 years, 7 months ago
I just finished my line-triangle collision detection and since I know have to know the world coordinates of every vertex of every one of my several thousand triangles in my game I was wondering if there is a fast way to do this, right now I am using my own rotation function in which I pass it a point and the x,y,z rotation and it gives me the rotated point location but there should be a faster way to do this using OpenGL. I just wanted to see if there is one before going ahead with the rest of my program. Thanks, -David
Custom rotation function is a good idea, because you know real-coordinates post-rotation without even thinking about it. As for collision testing, bounding spheres/boxes are a great way to speed things up. see psudo-code below

if object1.bound is near object2.bound:
loop(x, 0 to object1.polycount):
loop(y, 0 to object2.polycount)
if object1.poly[x] is touching object2.poly[y] then
declare_collision(object1, object2)
end if
end loop
end loop
end if

this cuts testing down by a huge amount if you have high polycount objects.

-Alex
Alex BroadwinA-Tronic Software & Design-----"if you fail in life, you were destined to fail. If you suceed in life, call me.""The answer is out there.""Please help, I'm using Windows!"

This topic is closed to new replies.

Advertisement