Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Maurice on August 12, 2011, 11:19:44 AM

Title: How do i rotate a cube with a joypad
Post by: Maurice on August 12, 2011, 11:19:44 AM
Who can help me with the following question ?

I want to rotate on the x-axis a cube with a joypad , how do i do that ?

I can move a cube forward and sideways, but i have tied several things to rotate it instead of sideways movement.

It is for a tank game.

Thanx Maurice
Title: Re: How do i rotate a cube with a joypad
Post by: Maurice on August 14, 2011, 10:34:14 AM
Bump
Title: Re: How do i rotate a cube with a joypad
Post by: qholmes on August 14, 2011, 10:41:53 AM
What type of character set up are you using?

Are you using Character Controller?

Q
Title: Re: How do i rotate a cube with a joypad
Post by: qholmes on August 14, 2011, 12:20:54 PM
If you are doing a tank game then you probably want to rotate in the Y axis...

I do not know how to get input from the JoyPad.. maybe you already have that working. I dont own one.

Q
Title: Re: How do i rotate a cube with a joypad
Post by: Alex Chouls on August 15, 2011, 01:17:27 PM
Use Get Axis to get the player input (you can test axis input with the cursor keys and WASD as well as a joypad) and apply the input as a rotation around Y (or whatever axis you need to rotate around).

In the attached screenshot, the rotation is applied "per second" so it's frame rate independent. The input multiplier controls the max speed of rotation - in this case 90 degrees per second.

Unity's input manager gives you some nice smoothing on the inputs, so you get smooth rotation.
Title: Re: How do i rotate a cube with a joypad
Post by: Maurice on August 15, 2011, 02:01:03 PM
Thanks Alex, now i can go on with my game.

Maurice