Transforms are located behind the jeep sa start ng level. Since di naman nagbabago ang lanes natin, kunin na lang ang X-axis
Sample Code
// Bastahan lang to, di ko pa nasusubukan, paedit na lang XD
// Sa car controller script
public List<Transform> snapLocations;
public int currentSnap;
Update(){
if(Input.GetKeyDown(KeyCode.A)){
//Check kung di labis
if(currentSnap < 0) return;
currentSnap--;
//Dito magtitilt yung jeep
PlayAnimation("TiltedLeft");
jeepPosition = Vector3.Lerp(jeepPosition, new Vector3 (snapLocations[currentSnap].x, jeepPosition.y,jeepPosition.z), Time.deltaTime*moveSpeed);
//Pag naka snap na, balik na sa normal yung jeep
if(jeepPosition == snapLocations[currentSnap]){
PlayAnimation("Default")
}
}
if(Input.GetKeyDown(KeyCode.D)){
//Check kung di labis
if(currentSnap > snapLocations.Count) return;
currentSnap++;
//Dito magtitilt yung jeep
PlayAnimation("TiltedRight");
jeepPosition = Vector3.Lerp(jeepPosition, new Vector3 (snapLocations[currentSnap].x, jeepPosition.y,jeepPosition.z), Time.deltaTime*moveSpeed);
//Pag naka snap na, balik na sa normal yung jeep
if(jeepPosition == snapLocations[currentSnap]){
PlayAnimation("Default")
}
}
}
Yung animations na TiltedLeft at TiltedRight gawa na lang siguro sa animator ng frame na naka rotate yung jeep sa z-axis ng 45deg, tas yung default ay yung normal orientation
Sample Code