# How can I lock a component to follow the mouse on the Z-axis? 

**URL:** <https://forums.unrealengine.com/t/how-can-i-lock-a-component-to-follow-the-mouse-on-the-z-axis/2357571>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, Blueprint, question\
**Created:** [February 25, 2025, 3:36pm UTC](https://forums.unrealengine.com/t/how-can-i-lock-a-component-to-follow-the-mouse-on-the-z-axis/2357571 "2025-02-25T15:36:28Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [February 25, 2025, 5:32pm UTC](https://forums.unrealengine.com/t/how-can-i-lock-a-component-to-follow-the-mouse-on-the-z-axis/2357571/2 "2025-02-25T17:32:24Z")

</div>

Have a look here, there’s a bunch of examples:

> [@Left Mouse button pressed and released equivalent in enhanced input (or drag and drop)](https://forums.unrealengine.com/t/left-mouse-button-pressed-and-released-equivalent-in-enhanced-input-or-drag-and-drop/1633884/18):
>
> Here’s some script allowing for picking up stuff and moving it in a specific plane only we determine ourselves manually: The green debug plane visualises what’s going on. In short: shoot a beam (trace) from the screen centre towards the projected mouse cursor, when it eventually intersects that plane (which is infinitely large), place the actor at the intersect world coordinate. If I change the normal: You could derive this Normal from the actor itself instead:

---

_[View the full topic](https://forums.unrealengine.com/t/how-can-i-lock-a-component-to-follow-the-mouse-on-the-z-axis/2357571)._
