# rotate the object only 360degree for once

How can I rotate my Object 360 degree once from code.

``````    euler.z = 360.0f;

Quaternion rot = Quaternion.Euler(euler);
transform.rotation = Quaternion.Lerp(transform.rotation, rot, 0.1f);

``````

and it doesn't work...

I'm sorry but I don't understand your question. If you rotate something 360 degrees, you could simply not rotate it instead. 360 degrees are one complete turn. If you want to rotate it gradually around 360 degrees you should specify the code you posted. What kind of variable is euler ? Where did you insert this code ? Assuming, that you've written this in the Update function, you could try this c# code instead

``````float rotationleft=360;
float rotationspeed=10;
void Update()

``````

{

``````float rotation=rotationspeed*Time.deltaTime;
{
rotationleft-=rotation;
}
else
{
rotation=rotationleft;
rotationleft=0;
}
transform.Rotate(0,0,rotation);

``````

}

float rotationleft=360;
float rotationspeed=10;
void Update()
{

``````float rotation=rotationspeed*Time.deltaTime;
if (rotationLeft > rotation)
{
rotationleft-=rotation;
}
else
{
rotation=rotationleft;
rotationleft=0;
}
transform.Rotate(0,0,rotation);
}
``````

private float rotationLeft = 360;

``````private float rotationspeed = 10;

private float rotation;

private void Update()
{

rotation += rotationspeed * Time.deltaTime;

if (rotationLeft > rotation)
{
rotationLeft -= rotation;
}
else
{
rotation = rotationLeft;
rotationLeft = 0;
}
transform.Rotate(0, rotation, 0);
}
``````