How to set actor location in reference to MyCharacter

I want to change an actors location according to my player input. Basically I have a flying character that can select actors in the world, and I want to change their location on the X, Y and Zach axis when my character moves in the X, Y and Z axis.

I tried doing this with an Attach and keeping world position, but the actor rotates when I rotate my character… I’ve also tried setting the actors location using the Axis Inputs for MoveForwad and MoveRight, but that did not work either.

Any input would be awesome!

You can use the SetActorLocation node. On the Actor ( that you want to move) Tick function, get the character location, then split the vector, modify how you want such as applying an offset, then SetActorLocation from the vector.

This is probably the simplest way. It may be all you need, or it may look too locked.

You could set a timer call function node on the actor and every x seconds call a function that sets a target location from the character position. Then do a moveto that new location.

I don’t remember if there is an option to ignore rotatation in an attach. There may be.

I am having trouble figuring out what the offset should be… Just to clarify what I am trying to do, I am selecting an object in the world and once that object is select, it is to remain where it is and then update its location when my character updates its location.

I was able to accomplish this somewhat by setting the actors location to my location - the actors location. But this caused the actor to jump between two locations. The speed of the actor moving was also slower than my characters speed, and they should be the same.
here is a short video

Do you have a suggestion on calculating the offset?

Thanks for you help!

If you want to achieve an effect as if your character would carry the actor, then you could check out PhysicsHandleComponent (this wiki page might help you get started).

Otherwise, you could try to do smth like this.

In the very moment you ‘select’ an actor, you get it’s world location, and you subtract it from your character’s world location. You store the result under some variable X. In tick, you take that selected actor and set it’s world location to your character’s location + (or -, don’t remember, soz :p) the value you’ve stored in X variable. That should work and it shouldn’t rotate selected actor around your character when you rotate.

The attach to actor node can be used and set to maintain relative offset from the player, allowing the actor to update its position based on the player’s movement without having to worry specifically which input was entered. This also works for rotation and scale.

PERFECT! That is exactly what I was looking for! Works like a charm!
Thank you for your help!