I am planning to have a gameobject that can be picked up by a mouse click and when the mouse is released, the object will fall. Also, i want to manipulate the object by pressing a key (X) to rotate the object clockwise (on the Z axis) with a changeable speed in the inspector.
So far in the script i have set the axis as it is a 2d game
function Update()
{
var v = Input.GetAxisRaw("Vertical"); // v = -1 for down and +1 for up
var h = Input.GetAxisRaw("Horizontal"); // h = -1 for left and +1 for right input
if ( Input.GetKeyDown("X") )
{
//rotate
}
Many thanks
↧