PlayMaker Help & Tips > PlayMaker Help

Change rotation speed

(1/2) > >>

cb:
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:
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:
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:
I understand the logic behind the first part, but not so sure about the parallel fsm's. A quick diagram would help!

Alex Chouls:
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?

Navigation

[0] Message Index

[#] Next page

Go to full version