• News

• Industries

• Learning & Support

• Community

• Marketplace

# Help: How do i make two characters move around eachother?

Basically this a simple visualization of what i want to accomplish:

My goal is to be able to make two characters move around eachothers axis with a specific radius, as if both of them are holding the same object.
I’ve tried to use GetRightVector from it’s current rotation, but the character slowly moves further and further away, which means i have to make the character move forward when he’s too far away. This causes more trouble and makes it more complicated than it should be.

I’ve also done this in the level blueprint, as i wasn’t able to make one character get information about the other without doing it wrong.

In advance, thank you so much!

This looks like something I’m also trying to accomplish, but you’ve gotten way further than me haha. Sorry, can’t help you with anything though.

What about using the RotateAroundAxis node with the other character’s UpVector as the rotational axis?
This node: https://docs.unrealengine.com/latest/INT/BlueprintAPI/Math/Vector/RotateVectorAroundAxis/index.html

In Event Step, you can measure the distance between the characters, and if it’s too far away, move slightly closer; if it’s too close, move slightly further away.
This is really simple, actually, assuming you can get Character B from within Character A and vice versa.

Inside B, the vector to char A is simple Apos - Bpos; compare the length of this vector to something desired. If too long, add some small constant times the negative of the vector. If too short, add some small constant times the normalized version of the vector. Purposefully don’t normalize before adding the negative, to make a stronger attactive force the further away they are.

Tried this, and it worked perfectly for one character. But when i use this and move both characters at the same time, they start teleporting…

Omg that worked! Gotta look through that one and see why, but ****! Thanks alot eanan!

Btw, what did you use to get the other character ref? That’s genius for making it more tidy.

Good to hear.

Maybe it will help if you think of it like a clock face, with Character1 at the end of the minute hand and Character2 at the clock’s center.
All we’ve done is rotate the minute hand around Character2 by Character1’s amount (Speed x MoveForward). This gives us a new direction the minute hand is facing.
We can then use the initial distance between the 2 characters (VectorLength) and multiply that with our new DirectionVector, and add that to Character2’s location to give us a point at the end of the minute hand to place Character1.
Hope that makes sense. Probably not. I tried!

Anyway, the variable is just a variable I added in the ThirdPersonCharacter’s Blueprint (Variable Type=Character Reference).
I used the Level Blueprint to set their values when the level starts.

Kind of made sense! hahah, thanks mate! I think i spent a week or two trying this by myself and by trying to find videos on how to do it with no luck.

You’re welcome man. It’s definitely worth playing round with that RotateAroundAxis node, it comes in handy a fair bit.
Also; I know exactly how you feel spending time trying to figure things out. That’s how I learned this stuff too.

Good times.