This is what i have so far, only rotates one way on left click down, need it to do the opposite in the same script can anyone give me a hand?
using UnityEngine;
using System.Collections;
public class ArmRotation : MonoBehaviour {
public float force=20;
public float speed=10000;
private HingeJoint2D joint;
private JointMotor2D motor1;
void Start()
{
joint = GetComponent<HingeJoint2D>(); // Get hingejoint
motor1.motorSpeed = speed;
motor1.maxMotorTorque = force;
joint.motor = motor1;
joint.useMotor = false;
}
void Update ()
{
if(Input.GetMouseButtonDown(0))
{
joint.useMotor = true;
}
if(Input.GetMouseButtonUp(0))
{
joint.useMotor = false;
}
}
}