Segment collision point


#1

Hello everyone :smiley:

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 :slight_smile:
Edwood


#2

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.:


point = entry.getSurfacePoint(myAvatar)

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

David


#3

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

Edwood