{
The transform. The rotate (new Vector3 (0, 90));
}
A spinning method, when click the button, cube x instantaneous rotate it 90 degree (or is) directly, please click on the button when how to rotate at a constant speed cube like animation?
CodePudding user response:
In the update callCodePudding user response:
1, write in the updateFor example:
Protected void the Update () {
Transform. LocalEulerAngles=new Vector3 (90, 0, 0) * Time deltaTime;
}
This will be 1 second to turn over,
If to 2 seconds, then divided by 2 to 3 seconds, divided by 3, half a second and then 2 times,
Transform. LocalEulerAngles=new Vector3 (90, 0, 0) * Time deltaTime/5; For example this is need 5 seconds
CodePudding user response:
Want to uniform, you need per s certain rotating speed, so the landlord to add a speed and time?? (specific code is not write)CodePudding user response:
Good advice! I have to try,CodePudding user response:
Can be implemented in the Update, the transform localEulerAngles +=new Vector3 (90, 0, 0) * Time. The deltaTime;It is recommended to use DoTween plug-ins, in animation implementation is very convenient,
CodePudding user response:
with animation animation