Very simple push collision help

I’ve got this being set on my collision geometry:

colGeo = CollisionNode('world')

Then, over by my player controls:

    def setupCollision(self):
        self.cnode ='cnode'))
        ct = CollisionTube(0,0,0,0,0,-1,1)
        self.traverser = CollisionTraverser('playerCollision')
        self.pusher = CollisionHandlerPusher()
        self.traverser.addCollider(self.cnode, self.pusher)

Then, in my task update loop:


Now, because I have the line:


I can see the collisions, it’s just not stopping me.

:collide(error): Invalid attempt to detect collision from CollisionTube!

This means that a CollisionTube object was added to a
CollisionTraverser as if it were a colliding object.  However,
no implementation for this kind of object has yet been defined
to collide with other objects.

What am I missing?


Just what the warning says: you cannot add a CollisionTube to a CollisionHandler. You can only add a CollisionSphere, or a CollisionRay/Line/Segment.


Thanks David,

I just assumed I had done something wrong in my set up. Will there be better support for collision tubes in the future? It does match my player a lot better then a sphere or spheres.

Not likely, due to the mathematical difficulty involved with efficiently intersecting tubes with many other geometrical shapes.

You could use multiple spheres on top of each other to approximate the shape.

Alright, I’m working with spheres now. While I’m working on building the engine, I have a first person controller that lets me fly around the world, using “space” to increase the Z vector, and Q to decrease the z vector. When I’m facing a wall/floor and am moving toward it the collision works just fine. However, if I use the Q/Space option to move up and down I seem to be able to fly right through the world.

Is there a way to test to see if I’m just moving too fast and need to look here: … ng_Objects

Or if my problem is something else entirely? I don’t think I’m moving too quickly:

 if (self.keyMap["forward"] != 0):
  , (0,0.2,0))

The reason I don’t think I’m moving too quickly is that if I set that from 0.2 to 0.1, I still go right through (but I’m not sure what constitutes fast moving in Panda).


Try changing the setHorizontal setting on the CollisionHandlerPusher; it controls whether it should also work on the vertical axis.

That helped some, it seems to be a problem more if I change my collision sphere’s size to be less then 1. I’m trying to find a good balance.

Edit: I think I will have to use a collision polygon, as my world is a cube world and I get weird collision issues with a sphere…I’m hoping the cube fixes it.

Alright, collision poly suffers from the same lack of implementation as the collision tube. Back to spheres.

I’m parenting my collision spheres to, is there a way that I can easily prevent the spheres from rotating? I basically want to do a (0,0,0,1) and (0,0,-1,1), so that it looks like this:


However, since I’m using a first person style controller, when I rotate, it ends up looking like:




(please excuse the ascii representation :wink: )

I’ve been trying a couple of things, but it seems like I recall a built in Panda function to freeze the rotation, but I’m not finding it.

I think what I’m looking for is a way to only inherit the position from the node, and not the rotation. Is that possible?

You can run a task to reset the rotation every frame, or you can parent to a different node that doesn’t inherit a rotation.


Please pardon the stupidity, but is there a “clear rotation” function that I can be using each frame? It’s easy enough to throw into my task manager that I think that’s the route I want to go.

EDIT: Never mind! I got what you’re saying! :slight_smile: