Get Actor Transform confusion, not pointing correctly

I have an actor blueprint where I call GetActorTransform expecting it to have the forward vector pointing straight ahead from the actor’s world setup that I did in the editor with gizmos to position and rotate it. I see the arrow component pointing along the actor’s x axis, it all looks right in the editro when not playing. But the forward vector I am getting from GetActorTransform when PIE is empirically the world X axis. So confused. I’ve tried doing relative vs. world rotation in the actor’s instance properties in the editor, nothing changed. How can i debug?!@#?!@?#!@?!?@??? :frowning: thanks for any thoughts.

(note: the problematic actor in question is attached to a parent actor fwiw in case that matters? I had hoped assumed guessed that Get Actor Transform wouldn’t get confused by that.)

Hey @Plumtummy!

It might be getting set in an unusual way before it is called. Can you show us how you’re saving the Transform? Also, as part of this, try to print that with a printstring at multiple points to note its changes!

Let us know! :slight_smile:

btw… One other “funny” thing is that I have 2 graphical debugging hacks added: (1) i use the transform to draw a forward vector, (2) on tick i sometimes use Get Actor Forward Vector to draw a forward vector as well. (1) is pointing it seems along world/absolute X from Get Actor Transform whereas (2) points in the correct/expected/desired direction.

(I want to use Get Actor Transform because I want to spawn another Actor from this one’s transform.)

So going off of that, it matters:

(A) WHEN you are doing this,
(B) WHERE in the code you are doing this,
(C) HOW (What nodes) you are doing this. :slight_smile:

We’ll need that info to move forward, pictures are best! :slight_smile:

I spam printed out the transform on Event BeginPlay, and then on Event Tick (throttled with a random boolean) and they are all the same value. I don’t yet know how to check the values but I have to admit that it doesn’t look like a degenerate case of it pointing along the canonical world default xyz since e.g. the rotator is non-zero. (The order here is Location, Rotation, Scale.)

LogBlueprintUserMessages: [quick_spawn_fff_C_2] X=33112.065 Y=-19570.902 Z=1616.861
LogBlueprintUserMessages: [quick_spawn_fff_C_2] P=-1.563650 Y=-126.650460 R=0.374189
LogBlueprintUserMessages: [quick_spawn_fff_C_2] X=1.000 Y=1.000 Z=1.000

a) ok am i doing the debug drawing wrong?
b) but the spawned actor empirically is facing the “wrong” way in PIE and matches the debug vector drawn from the GAT, so they agree that it is “wrong”?

(Ok reductio ad absurdum I must be badly doing the math utterly wrong for that debug drawing?)

Do you have the “Actor Scale” Set? If it is 0 it will spawn the new Transform as such.

Try printing the transform here (ONLY here so it’s not confused with the others) and make sure it returns a non-zero! Preferably RIGHT BEFORE the spawn.

Sometimes UE has its quirks. Try setting that transform (transform 2, post scaling) as a new variable, then plug a “GET” node of that variable into the spawnActorFromClass.

Also just eyeballing it, you need to multiply the forward vector BEFORE adding, otherwise you’re adding negligible numbers before multiplying all of it. I think. I always have to play around with those a little bit.

Let us know your returns!

thanks super much for taking a look at this. i’ll update if i figure it out — but i am going to break off from it for now just because i’m probably not seeing the forest vs. trees right now :slight_smile:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.