I applied the look at mouse method and after that, unfortunately, I don’t get the rotation I want. It feels like the actor is rotated relative to the base of its axis, which will not allow it to look at the laser, as in the picture, the height of the camera binding was changed, the z-axis when calculating the actor to the monitor was also changed, but the result is still the same. I thought about calculating the correction, but it is a lot of load on the system, are there any ready-made solutions, or something like that?
(I do through plubrints like this, I make the coordinates of the mouse and actor viewport, then I calculate the rotation angle through the arctangent).
1 Like
add some value to the Z of the mouse hit location.
1 Like
Unfortunately, it’s already been tried. Even tied the axis to the same vector, which is used to build the laser, there are changes, but not the expected result, just now the discrepancy between the axes is smaller. I could not find the value manually, it seems that the dependence is not linear.
Perhaps you could show the rotation part of BP.
and what the laser is?
Ooooh, it will be very long BP.
First, it obviosly on Event tick
- Calculating the actor’s position relative to the window
2)Calculating the mouse’s position relative to the window
3)Then I subtract these values so that I can relate them to each other, so that when I approach the actor, the coordinates show (0;0).
4) Then I calculate the angle as if it were a right triangle, and it turns out that the x and y coordinate are the cathetes, and then I transform the angle value from (-180,180) to (0,360).
5)Then I rotate the actor, and then I do a little smoothing.
The laser is a vector, a point with the direction the laser pointer is pointing.
here it is
different points were tried, including the top of the head, chest, neck, with additional invisible objects.
The most effective solution I see for me is to use camera tilt, and sort of calculate the error relative to the base point at feet. I’ve shown how I envision it in the figure, but it seems like it would be a lot of overhead and lead to unnecessary calculations.
Thank you for your time.
1 Like
Please forgive me if this question seems silly, I’m new to ue, and I’ve been working on it for about 5-6 hours.
that’s real complicated that you’re doing there,dude.I didn’t read through it.
I kind of don’t know what the result you’re looking for.
Is it that wanting to rotate to look at mouse location?if so I could give an example:
if you mean something else very advanced,then I can not help further

. I believe other more experienced people could help.
One trick you could use is via the LinePlaneIntersect node. I used something like this in a metroidvania type project before to aim:
For a topdown game, maybe use the location of Spine_02 or 3 as the plane origin(to aim at roughly center mass) and 0,0,1 as the plane normal. Or just add 100 or so to the Z from the world loc returned by convert mouse loc.
1 Like