CollisionBox with collisions

Hello, i just recently found out about CollisionBox() but i have 1 question about it. How do i assign a name for it? when i print it its just “” and if i remember correctly collisionsEvents and Pushers require the name of the from and into object?

Hi, both NodePaths and PandaNode’s (I am pretty sure) take an name parameter in the constructor, like so:

myBox = CollisionBox('myCollisionBoxNameHere')

Hope this helps!


thanks! ill give it a shot, i didnt see a name parameter in the collisionbox parameters. Hopefully it weorks tho :smiley:

nope, no name parameter D: any ideas?

CollisionBox doesn’t have a name. ColisionNodes do, however, so you can assign a name to the collision node holding the box.

box = CollisionBox(index, 0, i, .5, .5, .5)

index 0, i are the xyz coordinates. Any ideas on why its not working? says CollisionBox has no attribute reparentTo so i cant reparent it to a collisionNode 0.o is there any documentation on them? XD lol

Yes there is example code in the manual.

heh i was just being stupid XD i havent used collisionSolids in a while, reparemtTo doesnt work with collisionSolids only addSolid XD hehe thanks! works now :slight_smile: