controlling movement of a component of a character

Hi everyone. I have a beginner question here. I am making a simple character in UE5 for learning purposes. As you can see on the pic, i have this jet body as the main mesh, and another long cube mesh acting as its robotic arm (forcep) as the component/child of the main mesh. I want to move the arm forward and backward by pressing a key for example E, and Q for moving the arm back to its origin. The arm will move slowly to a set max distance (lets say 20units from the origin) as long as the button is pressed. Im using set relative location and set world offset method, but cant make it work. Anyone can help me out? Thank you



Hey @aminamshow!

Instead of world offset, you for sure want to use “Local”! :slight_smile: That way it’s relative to its owner.

Try putting a print string after the action but before the world offset! That way we can know if it’s the movement itself or the input you’ve set up.

It looks like you’ve got some strange things for buttons on the Enhanced Input so this step will be critical to finding a way forward.

Let us know!

Thanks a lot!!! I used the local offset method, and it works! The arm can now move forward. Now finding a way to bring it back to its original position…

You should be able to do the opposite by using + instead of - on the vector length and use “Min forceps distance” and a >= instead of a <=!

I’d just copy that code and reuse it and just switch that out! :slight_smile:

Looks like you guy’s kinda have this figured out, figured I’d mention the “move component to” node though just in case it may help. Best of luck!

Using this logic, if the current position - initial distance <= max distance → then moves… i can move the arm forward at backward. i put the max distance to 500. but the problem now is, if i move forward to the max, then i could now move it backward… it also happens if i move the other direction… any idea what is wrong with blueprint?

Any help from anyone? Tq in advance

It’s as I said here. :slight_smile:

For the BACKWARDS you have to flip the check. You’re checking if <= max, not >= min. :slight_smile:

Thanks!!! It works!!! You guys are awesome!!!

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