# マウスカーソルの方向にメッシュを回転させたい

**URL:** <https://forums.unrealengine.com/t/topic/1155092>\
**Category:** 日本語 (Japanese)\
**Tags:** unreal-engine, question, Blueprint\
**Created:** [May 5, 2023, 7:20am UTC](https://forums.unrealengine.com/t/topic/1155092 "2023-05-05T07:20:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![N4nJL\_pd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@N4nJL\_pd](https://forums.unrealengine.com/u/N4nJL_pd)\
**Post date:** [May 5, 2023, 7:20am UTC](https://forums.unrealengine.com/t/topic/1155092/1 "2023-05-05T07:20:26Z")

</div>

お疲れ様さまです

【やりたいこと】  
・マウスカーソルの方向にMeshを回転させたい

【現状】  
・回転自体はできましたが、何故か90度ずれて回転してしまいます

以下に実装したBPを添付します

 ![2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/4/3/e4327f09b0d1c970edd0a4953ed5d88c06b0a170.png)  
 ![1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/1/2/b1280e090f208bf5cdaeb7c67af8732012ff7f9b.png)

MeshのRotateは-90度に設定してあります

 ![スクリーンショット 2023-05-05 155332](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/f/6/9f6515373c1b0000d684390026ccb73a4fdefc63.jpeg)

Twitterに動画も添付してますので合わせておねがいします

> <https://twitter.com/je5fRC7sJff04i9/status/1654201597810085888?s=20>

---

<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:** [May 5, 2023, 7:27am UTC](https://forums.unrealengine.com/t/topic/1155092/2 "2023-05-05T07:27:03Z")

</div>

LookAtRotation は、X ベクトルをその方向に向けます。あなたの銃の X ベクトルは 90 度ずれています

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/a/0/4a0e1eaf2433c3fb2a9f2b9bfad8608dcd3f86e9.jpeg)

---

<div class="post-metadata">

**Author:** ![N4nJL\_pd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@N4nJL\_pd](https://forums.unrealengine.com/u/N4nJL_pd)\
**Post date:** [May 5, 2023, 7:40am UTC](https://forums.unrealengine.com/t/topic/1155092/4 "2023-05-05T07:40:06Z")

</div>

Thank you for your response.  
It is not my intention to rotate in the X direction.  
I would like to rotate in the Z direction.  
How can I do that?

---

<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:** [May 5, 2023, 7:45am UTC](https://forums.unrealengine.com/t/topic/1155092/5 "2023-05-05T07:45:27Z")

</div>

I understand you want to rotate in Z, but LookAtRotation will always point the X vector at the target.

If I want my turret to point the gun at the target, the X vector must be along the gun

Notice, I have my gun ( cylinder ) attached to the turret cube, so I just need to move the turret. The X of the turret is facing along the gun

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/1/d/11d70e299ea231764d90999ca6a9657a498b1a53.jpeg)

Yours is like this

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/6/8/8686746639e366fa42b90dd514a5a74f54453b2c.jpeg)

so ‘lookat’ will point the side of the turret at the target.

---

<div class="post-metadata">

**Author:** ![N4nJL\_pd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@N4nJL\_pd](https://forums.unrealengine.com/u/N4nJL_pd)\
**Post date:** [May 6, 2023, 5:08pm UTC](https://forums.unrealengine.com/t/topic/1155092/6 "2023-05-06T17:08:35Z")

</div>

I’ve been thinking about it for a day and thanks to you I know what caused it.  
Thank you!

> <https://twitter.com/je5fRC7sJff04i9/status/1654894840700874758?s=20>
>
> 麻倉 詩音 @je5fRC7sJff04i9

---

<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:** [May 6, 2023, 5:21pm UTC](https://forums.unrealengine.com/t/topic/1155092/7 "2023-05-06T17:21:32Z")

</div>

🕶 👍
