Object rotation by mouse screen position
Hi! I have a model presentation app and have to get ability to rotate camera around the model (not to rotate model in front of the camera). Scheme should work with touch and LMB pressed as well.
Camera is a child to null static mesh "Cam_0_Dummy" and uses its rotation axis, so I need to rotate static mesh, not camera.
As I understand, I need to get mouse (finger) position on the screen when LMB is pressed or touch happens -> check current world rotations of the Cam_0_Dummy -> keep tracking the movement until LMB is released and constantly combine this data with Dummy world rotations. So, when rotation stops - Dummy should be left in the summ of previous rotation and the latest that was done according the length of the path that cursor made on the screen. When LMB pressed again I need that new "path" that mouse or finger does on the screen will be added to previous rotations, so movement will continue it's way. Pretty usual scheme.
Problem in current graph - every time LMB is pressed world rotations are reset and gets the new data from mouse position on the screen (#1 in the printscreen) , but not add it to previous condition that static mesh was left in. If Combine node (#2) with World Rotation of the Dummy is connected it works like a multiplier for rotations and makes object rotate as crazy)))
In more simple words... Imagine, that you are trying to scroll down the web page with mouse wheel and, every time you rotate the wheel, page goes back to top and start scrolling from the beginning)))
What should I add to this graph or change to fix the problem?
And in addition - is there any way to add limits to rotations? For example to lock rotations from 0 to 180 degrees.
Great thanks for any help! I really need it....
asked Dec 02 '18 at 07:55 PM in Blueprint Scripting
Follow this question
Once you sign in you will be able to subscribe for any updates here