Detecting Sides of Collision

Hello! Is there any way that Panda3D can determine which side of an object something has collided to? For instance, an object has 2 sides and I want something to happen when the object hits a specific side. What should I do?

What is the “into” solid? If it’s a polygon, then they are already single-sided, so you can split out the polygons facing one side from the ones facing the other side into a separate CollisionNode, and set a tag on this node (eg. side=front/back)

I want the solid to be on the whole object. Plus it is a CollisionHandlerBox.

You can check the local surface normal to know which side of the box is being hit.

How?

Thanks for reducing the word limit to three! :slight_smile: :slight_smile: :slight_smile:

entry.getSurfaceNormal()

@Thaumaturge told in my post using the ursina module post, that I have to use so. I should pass render, but what does the parameter do. It says it needs a NodePath.

It’s what you want the given normal to be relative to. In your case you probably just want to pass the “into” NodePath to get the local normal vector.

Hey, if your still having problems with this i think i made a video that covers something really similar. It deals with rotating something opposite of a wall depending on what direction the collision is relative to the character.
Visual Example Of Collision Direction

Thanks! Will check it out.