playMaker

Author Topic: Change rotation speed  (Read 4549 times)

cb

  • Junior Playmaker
  • **
  • Posts: 66
Change rotation speed
« on: July 20, 2012, 02:09:23 PM »
Hi,

I have a rectangular block turning like a hand on a clock, rotating at a constant speed from its pivot point in the centre. I need to vary the rotation speed to speed it up/slow it down as needed by increasing or decreasing the float variable used in the Y rotation vector. What's the best way for this in Playmaker? Experimenting with iTween didn't achieve any satisfactory results,  I can't seem to get PM to rotate the block in a loop while receiving values to change the float value for the Y rotation.


cb

  • Junior Playmaker
  • **
  • Posts: 66
Re: Change rotation speed
« Reply #1 on: July 21, 2012, 12:22:41 PM »
No directions on this ? I'm going to use an old fashioned script process, I'll loop the rotation with the script Update() and access it with Send Message, changing the variable used as the rotation speed from within an FSM as I can't see how iTween will do this from within Playmaker.


Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Change rotation speed
« Reply #2 on: July 22, 2012, 02:52:03 PM »
You should be able to just use Float Add. Make a State called Speed Up. While in this state use Float Add with Per Second checked (so it's frame rate independent) to increase the rotation speed.

You could put these Input states into a separate parallel FSM, so the rotate FSM is still running the whole time...

Does that make sense?

cb

  • Junior Playmaker
  • **
  • Posts: 66
Re: Change rotation speed
« Reply #3 on: July 22, 2012, 05:27:52 PM »
I understand the logic behind the first part, but not so sure about the parallel fsm's. A quick diagram would help!


Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Change rotation speed
« Reply #4 on: July 22, 2012, 07:06:20 PM »
Not at my computer right now, but I'll try to explain a little better.

One FSM just rotates the object using the rotationSpeed variable.

Add a second FSM to the object to control the rotationSpeed variable. This second FSM might have 3 states: WaitForInput, SpeedUp, SlowDown.

Does that make more sense?

cb

  • Junior Playmaker
  • **
  • Posts: 66
Re: Change rotation speed
« Reply #5 on: July 23, 2012, 02:54:09 AM »
Yes, that sounds good. I'm getting along great with PM overall but there's some areas, such as multiple FSM's that I'm a little cautious with as I don't quite know how they may impact the code speed and efficiency. A couple of FSM's running two separate functions on an object such as this would make a great tutorial movie too, I'm beginning to see how much use such an approach would be.