playMaker

Author Topic: Exact actions for this C# Code (mouse drag to rotate)?[SOLVED]  (Read 1561 times)

heavygunner

  • Sr. Member
  • ****
  • Posts: 344
Exact actions for this C# Code (mouse drag to rotate)?[SOLVED]
« on: January 14, 2020, 05:03:04 PM »
Hello !

I wanted to rotate the object with touch & slide on screen. I tried Mouse Look action. But, It is not giving perfect result as I expected.

I am making something similar mechanism like Helix Jump tower rotate. I found this tutorial. This look promising than Mouse Look action.

This is the C# code. What should I do (needed PM Actions) to get this result. Give small hint, I will do rest.


Code :


Video Link:
« Last Edit: January 21, 2020, 08:07:46 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Exact actions for this C# Code ?
« Reply #1 on: January 20, 2020, 10:34:20 AM »
Hi,

here we go:

 

Try to rebuild this, if you can't get it to work, I'll send you the scene.

Bye,

 Jean

Neikke

  • Full Member
  • ***
  • Posts: 134
Re: Exact actions for this C# Code ?
« Reply #2 on: January 20, 2020, 02:34:39 PM »
Yay! Thanks a lot Jean! I would never be able to come up with this solution!

The only thing I would add is probably having another Float Operator which converts positive "delta" to negative, therefore making an object rotate in the direction of the mouse drag!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Exact actions for this C# Code ?
« Reply #3 on: January 21, 2020, 08:07:20 AM »
Hi,

 it's already there on the very next action, "Multiplier" float fsm is set to -0.2, set it to 0.2 and you are good to go. I made it a inspector variable as well, so it's accessible in the fsm interface on the inspector.

Bye,

 Jean

Neikke

  • Full Member
  • ***
  • Posts: 134
Re: Exact actions for this C# Code (mouse drag to rotate)?[SOLVED]
« Reply #4 on: January 22, 2020, 07:49:44 AM »
That's strange Jean,

I did try setting multiplayer's value to from -0.2 to 0.2 and the rotation of the object was still opposite to mouse drag direction. Anyway, it works and it's great! Once again thanks a lot!