So I’m pretty new to scripting, and teaching myself about Lerping today. I have a script that moves an object from one position/rotation to another. But I want to understand how to get the current Transform info from the object that the script is a component of and the Transform of another object to be used as the target of the Lerp. Currently my simple lerping script just sends from a specific position/rotation to another:
var Begin_Rotation = Vector3(0,261.2132,349.1754);
var End_Rotation = Vector3(8.782372,269.7128,97.0043);
var timer = 0.0;
var speed = 0.5;
var Begin_Position = Vector3(-4.518043, 0.9568615, 1.280597e-05);
var End_Position = Vector3(3.576072, 0.8233643, -1.32454e-05);
function Update(){
timer += Time.deltaTime;
transform.eulerAngles = Vector3.Lerp (Begin_Rotation, End_Rotation, timer*speed);
transform.position = Vector3.Lerp(Begin_Position, End_Position, timer*speed);
}
Can someone explain the basics of getting objects’ Transform info?
Who is upvoting these lies? transform is NOT a Vector3! And EVERY GAMEOBJECT has a TRANSFORM.
– flaviusxviiFlavius, my mistake. I meant to say
– guitarxeGameObject.transform.position, cool down :)