Hello guys!
Question is simple when I press left mouse button my character rotate just half way, but if I keep left mouse button down it rotates where it should. So How can I say if I press button once (not keeping it down) and do complete turn?
you will have to provide us with screenshots of the blueprint. I do not know what you are trying to do or how you are trying to do it, I cannot give you any answer.
My bad, here is a BP screens:
first and second images are shoot ray and turn player
third image is calling above function
so when I click may player turn but just a small bit, if I keeping mouse button down player turn fully. I need that I pressed (not keeping button down) and player do full rotation.
Alright, the problem is that the bool “Mouse Left Button Pressed” is set to false as soon as you stop pressing the button, wich mean that the function is not executed anymore and the rotation stop before finishing. I would recommend setting the bool “Mouse Left Button Pressed” to false only after you checked that the current rotation is equal to the target rotation in your Function.
Edit: Rinterp, or any interp, need to be executed at event tick for as long as the interp is not finished. Interp actually calculate of how much it should modify the current value toward the target value to get the interpolation to last the interp speed value, wich mean that the interp must be executed every tick.
I can say its working but not working If i clicked mouse button I need that mouse pointer stay in same position and wait till my player end turn and then it sets to false…
But how I said I need mouse button pressed > true and call function then mouse button > false (but function keep rotating till end). Hehe I don’t know how to explain hope you understand
For the “==” node, I would have used a “equal(Rotator)” node instead and used it to compare the 2 rotators that you input into the 'Rinterp To" node. as for the mouse pointer… What mouse pointer?
mouse pointer I mean mouse position. Rinterp To I used for make slowly and nice rotation(dont know maybe better to use Lerp).
To better illustrate what I need and what I got so far here is vid:
[video]exapmle - YouTube
as you can see from video now when i press mouse button player turn and when turns complete sets to false but if rotation not complete video tells it all
okay so you use the value “Mouse Left Button Pressed” elsewhere to update the target rotation and do not wish to update that target DURING the rotation. Well you need to:
-create a new bool Called, for example: “Ship is rotating” and set it to true when mouse button is pressed as well as “Mouse Left Button Pressed”
-Set “Mouse Left Button Pressed” to false when mouse button is released.
-On the branch, use the value “Ship is rotating” instead of “Mouse Left Button Pressed”
-when the rotation is finished, set “Ship is rotating” to false, instead of “Mouse Left Button Pressed”
hmmmm, the function that make that trace and update the target value only execute itself while “Mouse Left Button Pressed” is true, right?
so it should stop updating he target when you release the button, while the rotation Function keep executing until the second bool “Ship is rotating” is set to false by the function.