|
I have a tank navigation working with the WASD keys and would like to Rotate the Turret using the Arrow keys, Forward Arrow = North, Backward Arrow = South, Left Arrow = East, Right Arrow = West. I'm not sure the of the method that I should use to approach this, any suggestions?
(comments are locked)
|
|
In update(), test if the key is down and apply a localrotation to your turret's rotatable mesh something like this: if( Input.GetKeyDown("J" ) ) { turrentTransform.localRotation *= Quaternion.Angleaxis( 10 * Time.DeltaTime, Vector3.up ); } Here is the code I'm using. Nothing happens when I press J, any suggestions? using UnityEngine; using System.Collections; public class TurretRotationTest : MonoBehaviour { }
Jan 18 '11 at 04:23 AM
boomcrash
GetKeyDown only fires once until you release, try using GetKey, did you see if your code is getting run, add some Debug.Log calls
Jan 22 '11 at 11:37 AM
Jeston
@Jeston Please format your code
Feb 09 '11 at 11:50 PM
fireDude67
(comments are locked)
|
