# Transform mouse line trace to VR controller line trace

**URL:** <https://forums.unrealengine.com/t/transform-mouse-line-trace-to-vr-controller-line-trace/659604>\
**Category:** XR Development\
**Tags:** Motion-Controller, unreal-engine, UE5-0, question\
**Created:** [September 30, 2022, 8:36am UTC](https://forums.unrealengine.com/t/transform-mouse-line-trace-to-vr-controller-line-trace/659604 "2022-09-30T08:36:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bright360F](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bright360f/32/573853_2.png) [@Bright360F](https://forums.unrealengine.com/u/Bright360F)\
**Post date:** [September 30, 2022, 8:36am UTC](https://forums.unrealengine.com/t/transform-mouse-line-trace-to-vr-controller-line-trace/659604/1 "2022-09-30T08:36:15Z")

</div>

Hello everyone. I’m making a simple citybuilding game in VR.

I first made the game for non-VR and later decided to transform it to a VR game.

I’m currently using a line trace from "Convert Mouse Location To World Space’ to make the buildings snap to the closest grid cell, but now I need to make it so it uses the line trace that gets casted from my controller to decide which grid cell to snap to.

I’ve also made a line trace that starts from the controller. They’re in 2 different blueprints so I’m having trouble with how to “combine” them together

**My question would be is how do I use that MotionControllerRightAim reference in a different blueprint OR how do I use the placeable actor variable in a different blueprint?**

VRPawn linetrace:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/1/5/5159e561f9eb6d96d750d82cb6d71bbe4fd185d3.png)

Mouse linetrace:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/5/d/e5d3ba6a89fd9954b66ac14adb777425b282e124.png)

Placeable actor that’s in the blueprint where the mouse linetrace is:  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/b/4/5b417602d3bb967e4e031555ac1432dccff20c6b.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/f/8/1f853fcbc0b5bebf6d1dfd98fcc8ffdb513482b3.png)

---

<div class="post-metadata">

**Author:** ![Supremative](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/supremative/32/906564_2.png) [@Supremative](https://forums.unrealengine.com/u/Supremative)\
**Post date:** [September 30, 2022, 9:08am UTC](https://forums.unrealengine.com/t/transform-mouse-line-trace-to-vr-controller-line-trace/659604/2 "2022-09-30T09:08:06Z")

</div>

You could do it in the following way:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/d/b/adb26b985c38eb74d89dee447ba1d5fb7f6ebd27.png)

[My Products](https://www.unrealengine.com/marketplace/en-US/profile/Aleksandr+Sidorov)

---

<div class="post-metadata">

**Author:** ![Bright360F](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bright360f/32/573853_2.png) [@Bright360F](https://forums.unrealengine.com/u/Bright360F)\
**Post date:** [September 30, 2022, 9:20am UTC](https://forums.unrealengine.com/t/transform-mouse-line-trace-to-vr-controller-line-trace/659604/3 "2022-09-30T09:20:06Z")

</div>

Thank you so much, this worked
