Rotating a Sprite with PolygonCollider2D cause unity to hung up
I have discovered this strange behavior when I am creating a simple scene for my students: I simply put a sprite on the screen with a PolygonCollider2D, and I have attached a simple script that move the sprite in a single direction and rotate the sprite around the z axis, and guess what ? unity hung up ! when I remove the line that rotate the sprite everything work without any problem. any idea ?
public class Astroid : MonoBehaviour
{
public float speed = 1;
public float rotationAngle = 1;
public float rotationSpeed = 1;
void Update()
{
transform.position = transform.position + Vector3.right * speed * Time.deltaTime;
rotationAngle = Mathf.Repeat(rotationAngle + rotationSpeed, 360);
transform.rotation = Quaternion.AngleAxis(rotationAngle, Vector3.forward);
}
}
not a clue. if it's really that part causing it maybe a different unity version works.
I am using Unity 5.5, and I have discovered that if I replace the PolygoneCollider2D with a simple BoxCollider, everything work. however my polygone collider is complex, if I simplify it, it will work. however it is very odd that we have such a problem
you should report that as a bug. a plygoncollider that's allowed to rotate but break the system with a high enough poly count is definitely one
Your answer
Follow this Question
Related Questions
Animations unwanted movement and rotation after updating 0 Answers
Rotation stops OnTriggerStay2D 1 Answer
Quaternion.FromToRotation - is it a bug? Possible workarounds? 1 Answer
When exporting from Blender, animation gets messed up 0 Answers
Very basic rotation BUG. transform.up = transform.up sets Y rotation to 0. 1 Answer