playMaker

Author Topic: Gun Rotation [SOLVED]  (Read 2650 times)

Andys

  • Playmaker Newbie
  • *
  • Posts: 30
Gun Rotation [SOLVED]
« on: March 28, 2013, 09:30:25 AM »
I have a gun on a tank i want to move up and down, the attached screen shot shows what i have done and works, but it will rotate a full 360deg, how can I clamp this to only work between two values?  say 0 to 90 deg, I tried a few different ways, but as i am quite new to the working of playmaker, struggle to find the correct action

Andy
« Last Edit: March 29, 2013, 04:45:10 PM by andysaunders »

greg

  • Junior Playmaker
  • **
  • Posts: 68
Re: Gun Rotation
« Reply #1 on: March 29, 2013, 06:32:10 AM »
You should be rotating X axis for up/down, so i assume you pre-rotated a cylinder for the tank barrel, thereby fucking up its axis. Don't scale/rotate objects inside unity, do it in your 3D application, else it becomes a mess to work with later on.

Maybe "get rotation" then "math clamp" on that? Might need to use set rotation as well, not sure.
« Last Edit: March 29, 2013, 06:35:26 AM by greg »

Andys

  • Playmaker Newbie
  • *
  • Posts: 30
Re: Gun Rotation
« Reply #2 on: March 29, 2013, 04:43:44 PM »
Managed to sort it out, used get position, stored it in a variable, then used get vector3 XYZ and stored the Y in another variable, then did a float compare to stop the rotation, then reset with get key up for up and down.

Andy