Adding Collisions - Which Logic Is Correct?

I’m wondering if I’m making a huge mistake here with collisions. Panda3D has one hell of a logic behind its making.

Here is the example code -

Logic A:

Object1 = NodePath(PandaNode("RayHldr"));
Object1.reparentTo(render);
Object1Mask = Object1.attachNewNode(CollisionNode('ModRay'));
Object1Mask.node().addSolid(CollisionRay(0, 0, 0, 0, -1, 0));
Logic B:

Actor1mask = MyActor1.attachNewNode(CollisionNode('Act1Node1'));
Actor1mask.node().addSolid(CollisionSegment(0, -1, 10, 0, -7, 10));

In “Logic A” I’m creating a new PandaNode and I’m attaching a collision node to it.

In “Logic B” I’m attaching a collision node to an Actor, which has geometry, instead of a new PandaNode (which doesn’t have geometry).

What I want to know is, am I creating extra collision checking in “Logic B” because of using an Actor (which has geometry)?

I just want to make sure an Actor’s geometry isn’t some how being thrown into the collision checking because of attaching a collision node to the path.

There is no problem with attaching a CollisionNode directly to an Actor.

You do want to avoid accidentally computing collisions against visible geometry, but simply attaching a CollisionNode to an Actor won’t make that happen. That will happen only if you are careless with your collision masks, which are the controls you use to specify which objects you are testing for collisions.

It’s a little confusing that you use the word “mask” in your examples to refer to the CollisionNodes you create, since CollisionNodes are not masks.

David

Not really. You’re going to add a solid to the Node, which defines collisions. With other engines I’ve used, a mask is just that; a shape, rather 2D or 3D, which defines collision.

I would be total lost trying to program P3D if I used P3D’s terms only. It’s like when you store a NodePath in a variable… I like to think of that varible as an instance ID, which points to that instance of whatever class.

Therefore, Node to me is Object and NodePath is Instance ID. Of course those are terms used by other engines of the past, but it helps me to keep things straight in my head.

What is even more unusual with P3D is the fact some functions/methods only work on the Path while others only work on the Node.

Wow.