Rotating an object towards the mouse
We are working on a 3D Sidescroller (using the sidescroller template as a base). Our character can shoot bullets from himself and the player will use the mouse to aim. Currently I am trying to rotate a spot light around the player that faces in the direction of the mouse, this will be used to help aim. I have the behavior I would like when the player is aiming on the lower half of the screen. However, once you begin to aim above the player, the spotlight begins to shine in the direction opposite the mouse, obviously not what I would like.
Here is the blueprint I am using to calculate a point in 3D space that represents the mouse location, I found this after reading through forum posts here on unrealengine.
And here is the blueprint I am using to rotate the spotlight:
Any ideas on why I am getting this behavior and how to correct it?
asked Jan 13 '16 at 06:14 PM in Blueprint Scripting
Of course I solved the issue nearly immediately after posting this. When getting the mouse position from ConvertMouseLocationToWorldSpace, I was projecting the mouse location into 3d, but since Unreal uses a different coordinate system, we were dividing z/z instead of x/x. Changed that and now it is working like a charm!
answered Jan 13 '16 at 06:23 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here