CollisionSegment Example with Moving Target

Can someone give me an example of using a CollisionSegment between a camera and a moving target(3d person camera view). I’m using this to detect objects that get in the way of the camera and I couldn’t find a good example of CollisionSegment being used.

Thanks :slight_smile: .

So you guys can tell me where I’m going wrong in my camera manager when I initialize it I am doing.

raygeometry =  CollisionSegment(,
        self.cameraCollider ='CameraNode'))

and then in my cameras update loop I’m doing this.


which I want it to produce results like this:

but instead produces results like this:

I feel like my ray is wrong or I’m not setting ti right. I’m grateful for an help on what I might be doing wrong here. Thanks!

I note that your ray is a child of the camera, therefore it automatically inherits the camera’s position. So setting point A to camera.getPos() is adding the camera’s position to itself, and setting point B to dog.getPos() is just the wrong thing altogether.

Probably you intended your ray to be a child of render instead of the camera. Then you can use camera.getPos() and dog.getPos() in the way you are using them.