playMaker

Author Topic: How do i rotate a cube with a joypad  (Read 3785 times)

Maurice

  • 1.2 Beta
  • Playmaker Newbie
  • *
  • Posts: 23
How do i rotate a cube with a joypad
« 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

Maurice

  • 1.2 Beta
  • Playmaker Newbie
  • *
  • Posts: 23
Re: How do i rotate a cube with a joypad
« Reply #1 on: August 14, 2011, 10:34:14 AM »
Bump

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: How do i rotate a cube with a joypad
« Reply #2 on: August 14, 2011, 10:41:53 AM »
What type of character set up are you using?

Are you using Character Controller?

Q

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: How do i rotate a cube with a joypad
« Reply #3 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

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: How do i rotate a cube with a joypad
« Reply #4 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.

Maurice

  • 1.2 Beta
  • Playmaker Newbie
  • *
  • Posts: 23
Re: How do i rotate a cube with a joypad
« Reply #5 on: August 15, 2011, 02:01:03 PM »
Thanks Alex, now i can go on with my game.

Maurice