Hello, im fairly new to Javascripting and im having a hard figuring out how to slowly change the rotation of one object to match the rotation of another object. This is my script so far:
var garage : Transform;
var garageTargetA : Transform;
var garageTargetB : Transform;
var speed = 10;
function OnMouseOver () {
Debug.Log("You're Mouse Hovered");
if (Input.GetKeyDown("e") && garage.position.y == garageTargetB.position.y) {
garage.position = garageTargetA.position * Time.deltaTime * speed;
garage.rotation = garageTargetA.rotation * Time.deltaTime * speed;
Debug.Log("The Garage Has Opened");
}
if (Input.GetKeyDown("e") && garage.position == garageTargetA.position) {
garage.position = garageTargetB.position * Time.deltaTime * speed;
garage.rotation = garageTargetB.rotation * Time.deltaTime * speed);
Debug.Log("The Garage Has Closed");
}
}
Please Help and Thank you!
Thank you, but for some reason the Object just teleported to a random location.
– ArrowArcher2