Announcement

Collapse
No announcement yet.

Mouse button question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Mouse button question

    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?

    Thank you!
    Last edited by SWipiS; 02-29-2016, 12:37 PM.

    #2
    anyone know the answer?

    Comment


      #3
      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.

      Comment


        #4
        My bad, here is a BP screens:
        first and second images are shoot ray and turn player
        Click image for larger version

Name:	1.jpg
Views:	1
Size:	143.5 KB
ID:	1101458
        Click image for larger version

Name:	2.jpg
Views:	1
Size:	149.8 KB
ID:	1101459
        third image is calling above function
        Click image for larger version

Name:	3.jpg
Views:	1
Size:	75.2 KB
ID:	1101460

        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.

        Thanks

        Comment


          #5
          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.
          Last edited by JX53mb; 02-29-2016, 06:37 AM.

          Comment


            #6
            Good point! I will try now, thank you.

            Comment


              #7
              no problem! Let me know if you get it to work.
              Last edited by JX53mb; 02-29-2016, 06:52 AM.

              Comment


                #8
                so I got this
                Click image for larger version

Name:	1.jpg
Views:	1
Size:	221.3 KB
ID:	1101465

                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
                Last edited by SWipiS; 02-29-2016, 08:42 AM.

                Comment


                  #9
                  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?

                  Comment


                    #10
                    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:
                    https://youtu.be/9O2wVGaIiVQ

                    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
                    Last edited by SWipiS; 02-29-2016, 09:16 AM.

                    Comment


                      #11
                      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"

                      Am I correct?

                      Comment


                        #12
                        yea I did this but result is still the same as in video... it is harder then I thought

                        Comment


                          #13
                          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.

                          If that does not work I just don't understand x)

                          Comment


                            #14
                            I guess so (I new here so hard to tell I doing good way or wrong way). hope someone understand what is wrong in my BP

                            Comment


                              #15
                              Thank you JX53mb for your time and your solution!

                              Comment

                              Working...
                              X