Segment collision point

Return to Scripting Issues

Segment collision point

Postby Edwood Grant » Mon Aug 01, 2005 12:35 pm

Hello everyone :D

I've been programming some time with panda 3d, and i am implementin g right now a camera that "collides" with all objects, with walls and trees and everything, so that the character never gets blocked with a wall, or that the camera moves away from the world and ends looking weird, for that kind of collision i put a collision segment between the camera and the character, so when it detects something that blocks it, would move to exactly that position, but i dont know if it is posible that i can know exactly in which point the segment collided? then it would be easy to calculate distance between the point and the character, so i can put back the camera in an apropiate place.

Thank in advance :)
Edwood
"Oh, im just too good for my own bad self"
Shwang Shwing

"Vengeance is cold and sweet... just like an ice cream!"
User avatar
Edwood Grant
 
Posts: 19
Joined: Sun Jun 06, 2004 12:41 pm
Location: Bogota, Colombia

Postby drwr » Mon Aug 01, 2005 2:34 pm

The parameter passed to the event handler is an object of type CollisionEntry. You can query this object for the point of collision, e.g.:
Code: Select all
point = entry.getSurfacePoint(myAvatar)

which returns the point of collision, in the coordinate space of myAvatar.

David
drwr
 
Posts: 11425
Joined: Fri Feb 13, 2004 12:42 pm
Location: Glendale, CA

Postby Edwood Grant » Mon Aug 01, 2005 5:22 pm

That was just the thing i needed, thanks a lot David :D

Edwood
"Oh, im just too good for my own bad self"
Shwang Shwing

"Vengeance is cold and sweet... just like an ice cream!"
User avatar
Edwood Grant
 
Posts: 19
Joined: Sun Jun 06, 2004 12:41 pm
Location: Bogota, Colombia


Return to Scripting Issues

Who is online

Users browsing this forum: Bing [Bot] and 0 guests