# playMaker

### Author Topic: 2D Rotation on Z axis [SOLVED]  (Read 386 times)

#### MIKMANNER

• Newbie
• Posts: 10
##### 2D Rotation on Z axis [SOLVED]
« on: January 23, 2012, 01:16:35 PM »
Hello - I have a scene set up where my camera is looking at the 'back' perspective. I want my gameobject to rotate at the mouse position on its Z axis.

I can't work it out, how do I store the mouse X,Y position and set the Z angle to look at it?

Thanks for any help

Mik
« Last Edit: February 29, 2012, 11:41:26 AM by Alex Chouls »

#### jeanfabre

• 1.2 Beta
• Hero Member
• Posts: 3343
##### Re: 2D Rotation on Z axis
« Reply #1 on: January 23, 2012, 11:37:28 PM »
Hi,

Can you describe what you have tried so far?

You need to use my magical custom actions for this

http://hutonggames.com/playmakerforum/index.php?topic=272.0

This action allows you to track the mouse position on a plane. So, set up this action and the plane to be your XY and you will then retrieve the mouse position in that plane. you then can have your gameObject looking at this position or compute the angle you want between the two.

If you struggle, let me know, I'll do a working example and send you a unity package.

Bye,

Jean

#### MIKMANNER

• Newbie
• Posts: 10
##### Re: 2D Rotation on Z axis
« Reply #2 on: January 27, 2012, 11:52:44 AM »
That's excellent thanks!

Hi,

Can you describe what you have tried so far?

You need to use my magical custom actions for this

http://hutonggames.com/playmakerforum/index.php?topic=272.0

This action allows you to track the mouse position on a plane. So, set up this action and the plane to be your XY and you will then retrieve the mouse position in that plane. you then can have your gameObject looking at this position or compute the angle you want between the two.

If you struggle, let me know, I'll do a working example and send you a unity package.

Bye,

Jean