Question by
SelayCC · Feb 03 at 02:41 PM ·
rotationunity 2ddragdrag objects
Rotate and Drag Problem
I am moving my object with onDrag, but there is a situation like this: I do not want to execute a drag if the sprites are rotated, but if the sprites are not rotated, I want drag to be executed. The Unity 2d code is shown below.
if( !drag )
{
if( rota<13 )
{
rota = rota + 0.5f;
//rectTransform.anchoredPosition += eventData.delta;
mPosDelta = eventData.delta - mprevpos;
transform.Rotate( 0 , 0 , rota , Space.Self );
}
else
{
this.transform.rotation = Quaternion.Euler( 0 , 0 , 180 );
Invoke( nameof(Wait) , 3f );
}
}
else
{
rectTransform.anchoredPosition += eventData.delta;
}
Comment
Your answer
Follow this Question
Related Questions
Pausing a quaternion back and forth sin rotation based on time.time 1 Answer
Rotating a sprite with mouse movement 0 Answers
Convert movement direction into rotation? 0 Answers
Rotation Flicker in 2d platformer gun 0 Answers
Smooth rotation problem 1 Answer