Okay so I’m working on a blueprint, And there is 1 actor of the BP that should always face the player. And the rest should stay static. So I’ve tried coding the “one actor” to always face the player, but all of the actors seem to face the player even though I tried only making the one actor face it. I might be stupid but can anyone help pls? Btw here’s the code for the look at/face player feature
Gonna need to do a bit of guessing here because we’re lacking info about your BP’s hierarchy and how exactly GPMesh
is initialized. Seeing as it’s a component (based on the GetOwner
function call), I think your hierarchy is similar to this:
If that’s correct, keep reading. If not, correct me with some extra info.
Assuming this is correct, we need to clarify some terminology first - GPMesh
is not an actor in this case, it’s a component of the actor whom you’ve described with your blueprint. That’s the same actor you’ll get when calling GetOwner
on GPMesh
; meaning, if you then SetActorRotation
you’ll rotate the actor and (consequently) all its components. If you just want to rotate a single component, for example GPMesh
:
- replace the
GetActorLocation
call withGetWorldLocation
and pass in the component directly - replace the
GetActorRotation
call withGetWorldRotation
and pass in the component directly - replace the
SetActorRotation
call withSetWorldRotation
and pass in the component directly - the new node will have a Rotator input instead of XYZ, just split the Rotator using “split struct pin” (see image) and connect your green wires
2 Likes