Issues with a collision segment

Hi there, I am facing some problems trying to use a collision segment.

When I call sort/clear I am receiving an assertion error, it says that entry does not have into information. I print the entry and all seems ok.

Using the debug I found that the segment is missplaced, but I can’t find why. The collision segment was added to a collision node attached to the base camera. I am setting pointA as and pointB as a model.getPos().

So my questions are:

  1. Is there anything I should take care with, considering the positioning?
  2. Any ideas on why this assertion exception is being raised?

Thanks in advance.

It sounds like there is some logic or math error in your code, but I don’t think we can give you any useful advice with such a generic question. Perhaps you can narrow your question down to something more specific?


There is no math involved, I am just setting one point as and the other as somemodel.getPos().
I would expect this would create a segment from the camera to the model.

My question is, what can be going wrong with this? the getPos method will return the position on the world or relative to the some other system (for instance scaled)?

Thanks in advance.

getPos() returns the position relative to the node’s parent. In Panda, each node potentially defines a new coordinate space, so if all of the nodes are parented to render (for instance), they’re all in the same (global) coordinate space, but if they have different parents then they might be in different coordinate spaces.

This is a potential for confusion, but the error that you describe doesn’t sound like it’s necessarily due to getting the wrong values for start and end. It could be any number of other things. From what you say, it sounds like it’s complaining that you’re trying to ask a CollisionEntry for its into point, and it either wasn’t involved in a collision, or it was involved with a collision that didn’t compute an into point.

As to how you ended up with such a CollisionEntry when you expected to have a CollisionEntry that had an into point, for that we can only offer vague guesses.


Thanks for the reply, I am not really worried about the AssertionError, as the ray is not positioned.
I didn’t reperent the camera to the render, but I would assume it is done automatically.
I am using flattenLight on the model after the scale, I do not believe this could create problems, tought.

I will keep trying.

Building on what drwr said, have you tried setting point B to be “model.getPos(render)”? (Note the addition within the brackets.)

This doesn’t work with an Actor. I tried with the camera and it worked.

I’m also encountered with these problems sir but im searching many sites and nice having here, im kinda having lot of difficulties and wonder if there is logic or mathematical error engage…

Can u help me guys?

I am proud of the fact that I the one who invented weapons like combat knives.

Well, could you give us some details about your problem, please?

In general, however, each NodePath essentially defines its own coordinate space: objects can be said to be in a given position relative to it. In particular, objects that are parented (either directly or indirectly) fall under its coordinate space. As a result, moving the parent object results in its children being moved, and an object being at position (0, 0, 0) means that it’s at the same position as its parent (not necessarily at the global origin).

However, if you want an object’s position (or H, P or R, etc.) relative to another object (such as the root node), simply call “getPos()” (or “getH(…)”, etc.), such as “getPos(render)” to get an object’s position relative to the root node named “render”.

(Please note: it’s possible that I am in error in some of the above; my apologies if this is the case, and I stand to be corrected.)

First, thanks for the clarification.
Here is how I load/place the model:

  self.player = Actor(
  self.player.setPos(self.xTranslation, self.yTranslation, self.zTranslation)
  if (self.serverSide == False):

Then I Position the camera:

  angle = radians(self.charRef.getLookingAngle())
  camX = self.camDist * sin(angle)
  camY = self.camDist * cos(angle) + (x, y, self.camHeight)) + (0, 0, 2.5))

charRef is a reference to the Player object, that holds the model.

Finally here the segment is place/created. After reading your explanation, I believe the problem is here, when I attach the new Node:

  self.__cameraCollisionNode = CollisionNode('cameraRay')
  self.__cameraNP =
  self.__cameraCollisionSegment = CollisionSegment()

  self.__cameraCollisionQueue = CollisionHandlerQueue()
  base.cTrav.addCollider(self.__cameraNP, self.__cameraCollisionQueue)

So, if I get the position relative to the Render, would it work? I tried, but actor getPos() is not working with an argument. Probably I need to find the actor NodePath?

Thanks in advance.

Hmm… Is “charRef” a reference directly to self.player? If so, then that shouldn’t be an issue - it seems that self.player is parented directly to render, so it should be in render’s space.

Instead, I’d suggest as the poster above did: get the your camera node’s position relative to render. In other words:


I’m not at all sure of why “getPos()” isn’t working with an Actor - although I’ll confess that the API reference is throwing me off a bit by showing Actor as not being a descendant of NodePath or PandaNode, yet still having methods like “reparentTo”… o_0

To one of those more expert than myself in the inner workings of the engine: what is going on here?

A quick experiment on my end found that “getPos(render)” called on an Actor seems to work, so unless we’re using different versions and they differ on this point, that shouldn’t be a problem.