Download

Comp. world location dramatically different (but not physically different) after actor detachment

I am looking for insight as to why this is happening… it’s weird and I’ve debugged the hell out of it.

I have a beam object… it has a BeamTail mesh component and a BeamHead mesh component. They are parented to a root mesh component. When the beam is in transit, the head moves like a projectile, and when the beam is detached, the tail also begins moving like a projectile. (A third object, the middle of the beam, is scaled between the two.) The root component never moves, but as the attachment point, allows the beam to sweep as the emitter moves.

The beam actor is attached to a laser emitter actor on the pawn.

When the beam fires, the actor is spawned, and attached to the laser emitter. When the beam ceases firing, the beam actor is detached from the emitter.

As I inspect the world locations of the beam actor, its root component, and the BeamHead component, they dramatically change after the frame on which the beam actor is detached from the emitter… BUT, neither the actor nor components reflect this change with their physical location in the world.

So, as an example, if the BeamHead world location reported as (-3000, 100, 1200) the frame before the actor detaches, in the next frame, it ends up something like (7500, 2500, 4400) but is still in its expected physical location when I view it in the editor view port.

To further confound me, the relative location of the BeamHead appears correct, and the sudden change in world location doesn’t seem to have any correlation to the relative location.

It feels like the BeamHead component is using some other scene component up the hierarchy as its world frame of reference rather than the actual world origin when I call GetWorldLocation.

This is causing a lot of havoc with some spatial calculations I’m doing.

The heirarchy looks something like this:

  • Pawn:

  • ChildActor:LaserEmitter:
    [LIST]

  • Actor: Beam (attached when spawned)

[/LIST] Then when Beam is detached it ends up in the root of the scene as expected.

What am I missing here? What about Unreal am I not realizing?

(thanks!)