Tutorial: On the turn…

Alongside blocking in the environment and fiddling around with cameras, I took this morning to test out a system for making certain objects manipulable via the mouse. After a bit of head scratching I got it to work pretty well so I thought I share the Playmaker setup and a few notes…



The two cylinders on the left represent separate transform parents, this is to avoid gimbal lock and related silliness. Here’s the Playmaker setup, you’ll probably want to open up the full size version in another tab; it’s rather large….




Idle is waiting for a mouse event, in this case a mouse click. The FSM is actually on an invisible cube with a collider a bit larger than the cube you can see above, after a bit of fiddling it seemed more reliable and controllable to have this separate and static.

Rotate X or Y gets the absolute values for the change in mouse position so we can compare them without worrying about negative numbers, I wanted the rotation to be either around X or Y, not both at the same time, this way I can have a separate state handling each. You can find the GetMouseDeltaPosition action here, or just search “delta” in Ecosystem.

Both Rotate X and Rotate Y have the same actions, just for their respective axes. The first action changes the parent of the object we want to rotate, we apply rotations to that object instead and only around one axis, that way we always know what our pivot’s up to. Next we get the mouse position delta again. The float multiplication defines how quickly and in what direction the object will rotate in relation to mouse movement. This takes a bit of fiddling and will be different for each object, I’m using a cylinder with a 90° rotation as a parent for example, so both X and Y mouse delta values end up being applied to Y axis rotation. Depending on your own set-up there will be a bit of trial and error here; keep in mind the translation of the mouse along an axis is being applied as rotation around another axis and vice-versa. The mouse pick event at the end checks to make sure the cursor is still over the object and the button is still down.

Ease out X and Ease out Y aren’t necessary but act to soften the transition between dragging the object and letting go, it can be quiet abrupt otherwise. These states don’t update the Mouse X/Y variable, they use the last known values, this means that the ease out will be different depending on how fast the mouse was moving in the previous state. These actions can be fiddled with to achieve lots of different effects, a longer time value on the rotation, for example, would allow you to spin an object. The final mouse event action checks to see if the player has clicked, this makes sure they don’t have to wait for the rotation to completely finish before interacting again.

It’s pretty straight forward but works surprisingly well, I’m thinking I might use this for a few elements in Reel I would otherwise have had to use rigid bodies.

UPDATE: I posted this tutorial up on the Playmaker forums and user djaydino ponted out that iTween was getting a bit long in the tooth, at their suggestion I checked out DOTween. The set up is slightly different so I thought I’d include the alternative Ease Out state:


As ever, I’ll be floating around on TwitterTumblr and Facebook throughout development, if you have any questions. If you just want to hear about the big stuff, release dates etc. you can sign up to the Arcto Games Tinyletter.



3D-artist and fledgling Unity Dev. Currently working on a wordless point-and-click adventure game...

2 comments on “Tutorial: On the turn…”

  1. Oh crap another of my actions (doTween action).. I am so happy to see the actions being used..

    🙂 🙂 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *