Relative XYZ to parent bug [resolved]

Hi!

I created a model space ship with child turrets in Blender, and everything exported fine, the hierarchy looks like this.

ModelRoot -> CollisionPoly (Mesh)
          -> GeomNode (Mesh)
          -> TurretGroup (Empty) -> Turret1 (mesh)
                                 -> Turret2 (mesh)

Anyway, what im trying to do is, have the child turrets point at, and eventually shoot at, a target ship.

The problem is that the turrets wouldn’t point at the target, even with .pointAt(pos). I put in an echo on the position of the turrets and they seem to think their position is (-20.42, 161.30, 0) [Placer Panel confirmed this], but everymesh looks correct, even though they say they’re pretty far away.
This is wrong because the turrets are hanging on the sides of the ship, so more like (-.60/.60, 0, 0). Their parent is a PandaNode (the empty) that is a child of the main node, and the PandaNode says it’s relative position is (0, 0, 0) to it’s parent.

I’ve tried setting the turrets position’s manually to 0, but they they’re inside the model, and i dont want to set a manual offset for every turret i’ll ever add.

Thanks for the read. :slight_smile:

Because the turrets are getting its position base off the ship and not render… to get poistion from render you have to call render:

self.Node.getPos(render)

Again to set it base on render location you call render:

self.Node.lookAt(render, pos)

Ah! Thanks adr.

That worked perfectly, now everything is working without a hitch.