Hello. i work in JavaScripting. I try to animate a knife. I need to change the rotation : x to -50 to cut. But i need to be animated. Smooth move. And before to go rotation x to 0.
cutstep : int = 0;
if(Input.GetButtonDown("Fire1"))
{
if(cutstep == 0)
{
if(SwitchWeapons.Weaponcut == 1)
{
cutstep += 1;
}
}
}
if(cutstep == 1)
{
transform.Rotate(Vector3(-50,0,0));
cutwait();
}
if(cutstep == 2)
{
transform.Rotate(Vector3(50,0,0));
cutwait01();
cutwait02();
}
}
function cutwait()
{
yield WaitForSeconds(0.01);
cutstep = 2;
}
function cutwait01()
{
yield WaitForSeconds(0.01);
}
function cutwait02()
{
yield WaitForSeconds(0.01);
cutstep = 0;
}
It works but make fast move and look ugly… I can’t use animation for this object becouse is a prefab ,and don’t work i can’t make a new animation, and i try to make a script for animation but is so fast… Thx.