# Calculate Relative Transform between two points for MoveComponent

**URL:** <https://forums.unrealengine.com/t/calculate-relative-transform-between-two-points-for-movecomponent/481946>\
**Category:** Character & Animation\
**Tags:** move-actor, unreal-engine, transform, question\
**Created:** [April 14, 2021, 10:36pm UTC](https://forums.unrealengine.com/t/calculate-relative-transform-between-two-points-for-movecomponent/481946 "2021-04-14T22:36:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![devalx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@devalx](https://forums.unrealengine.com/u/devalx)\
**Post date:** [April 14, 2021, 10:36pm UTC](https://forums.unrealengine.com/t/calculate-relative-transform-between-two-points-for-movecomponent/481946/1 "2021-04-14T22:36:42Z")

</div>

Hey, i am currently struggling with the following problem:

Given two World Locations with Rotation, how do i calculate the Relative Location and Rotation for MoveComponentTo so the both Actor actually “map” on these Points in World Space? How would i achieve this for two points, if those are actually inside of two different Actors and those are not at (0,0,0) in Local Space inside the Component?

Context: I am using the VR Template and want to attach an Object to the Users Hands(MotionControllers) at some specific point of the Object, and i am using a Socket inside the Skeleton to do that.  
And this works with “Snap To Target” without using the Socket, but i want to use specific grab locations sometimes and therefore i want to use MoveComponentTo with “KeepRelative/KeepWorld” to actually move the Object as specified by the Socket (The Socket essentially should be the Location/Rotation of the attached MotionController, but i want to Move/Rotate the Object to the MC, and not the other way around).

Whenever a implement a transformation to Move to the final Location/Rotation its not as intended, is there any Documentation about this or can anybody explain how i would achieve that? Thanks!

More Info:

- Actor1 is MotionController\_BP

- Inside Actor1 is a HandMesh at Location (-12,0-2) Rot (90,0,0)[Local]

- Actor2 is Pickup\_BP with a SkelMeshCmp

- Inside the Skeleton of Pickup\_BP is a Socket at Location (50,30,0) Rot (0,45,90)[Local]

It seems to me that i am not correctly considering the Local-Space Transform of both Components (HandMesh, Socket), so all my latest attempts seem to result in a random location/rotation and not the one desired.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_5ebdf999](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_5ebdf999](https://forums.unrealengine.com/u/anonymous_user_5ebdf999)\
**Post date:** [April 15, 2021, 7:46am UTC](https://forums.unrealengine.com/t/calculate-relative-transform-between-two-points-for-movecomponent/481946/2 "2021-04-15T07:46:23Z")

</div>

Not sure if this will help or not but when it comes to socket location/rotation with transform space problems this node helps.

![335970-get-socket.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/2/e/92e4964774095c980bb194f68da4d2b42e89c30a.png)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [April 15, 2021, 7:52am UTC](https://forums.unrealengine.com/t/calculate-relative-transform-between-two-points-for-movecomponent/481946/3 "2021-04-15T07:52:35Z")

</div>

You can move between local / world transforms using the nodes:

 ![335972-screenshot-1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/8/2/682f786768d6d7c1a5dfa03635995471a2e527a8.jpeg)

Mouse over to find the relavant node, the crucial part of the description is the end:

 ![335973-screenshot-2.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/b/7/1b7de0dc950aae7f702f230f69d6a1b167380bb8.jpeg)

All you have to do ( in this example moving from world to local rotation ), is feed in the object world transform, along with the other params:

 ![335975-screenshot-4.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/e/6/2e62e54d38471bad6ef63c780e3f5fbb8a0c830f.jpeg)

---

<div class="post-metadata">

**Author:** ![devalx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@devalx](https://forums.unrealengine.com/u/devalx)\
**Post date:** [April 28, 2021, 9:17pm UTC](https://forums.unrealengine.com/t/calculate-relative-transform-between-two-points-for-movecomponent/481946/4 "2021-04-28T21:17:35Z")

</div>

Thanks for your answers, after digging a bit into it, i realized my Vector Math Skills are not good enough to implement it 😃  
I am using a Workaround now, by spawning a new (empty) actor, attaching it to the Socket and then set the Location/Rotation of that newly spawned Actor. After that i destroy it again.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [April 28, 2021, 9:27pm UTC](https://forums.unrealengine.com/t/calculate-relative-transform-between-two-points-for-movecomponent/481946/5 "2021-04-28T21:27:34Z")

</div>

ok cool 🙂
