- Home /
Rotate an object in a specific time
I found that YouTube video and the rotation of the plates you can see at 15 seconds is what I want to do. https://www.youtube.com/watch?v=3JyIPCn9Nis
So here is what I'm using to rotate my plates:
private var tCycle:float;
var Sekundenschlaf = 2;
var Umdrehungen = 2;
var ZuDrehenderWinkel = 180;
var WinkelFixierung_a = 90;
var WinkelFixierung_b = 180;
function Update(){
var t = Time.time;
if (tCycle-t<=Umdrehungen){
transform.Rotate(ZuDrehenderWinkel*Time.deltaTime,0,0);
}
if (t>tCycle){
tCycle = t+Sekundenschlaf;
if (transform.localEulerAngles.x<WinkelFixierung_a) {
transform.localEulerAngles.x = 0;
} else {
transform.localEulerAngles.x = WinkelFixierung_b;
}
}
}
It's working great so far. The only problem is the speed. I can't go slower than 45 degrees. I'm really bad at math. Could you give me some tipps on how to solve this, please?
Comment