# Can I have a fixed-angle sprite with a non-fixed-angle CircleCollider2D?

In Unity2D, can I have a fixed-angle sprite with a non-fixed-angle CircleCollider2D?

I would like to move my character using the circle physics (without fixed-angle), but display him always as if he wasn't rotated (as if he had fixed-angle).

I thought I could just let the collider rotate, and then rotate-back the sprite in the LateUpdate, however since the collider's center isn't 0,0, it "rotates sideway" and doesn't end up in the "original" position.

My knowledge on matrices and quaterions is null, and trigonometry is only slightly above zero, so I'm a bit at a loss... how can I achieve the desired effect?

In order to prevent a X/Y problem, I want to do that since with box colliders sometimes the characters got stuck: if a platform had even just 1 pixel step, the character couldn't walk over it. Also, slopes were a big problem. Changing the collider to a Circle was the obvious consequence; I also tried to detect and add a small vertical speed but it didn't work very well and was becoming a mess.

• I don't know Unity, but I think a picture would help. – Anko May 18 '14 at 22:48

Maybe you can just turn off the SpriteRenderer script so only your invisible collider still there and rotating, then make a new separate Sprite game object just for displaying the character. (Make sure this separate sprite is not a child of your collider or they will still rotate together.) Then attach a script that keep updating Sprite's transform.position to the same of your rotating collider.

• Yes, I was on this route lately – didn't work at first for some reason, and I'm debugging that. If I manage to make it work, I'll accept this answer, meanwhile I'll wait for other tips. – o0'. May 20 '14 at 18:49
• It worked, but I had to set the CircleCollider center to 0,0 and pivot the Sprite instead. – o0'. May 24 '14 at 14:14

Ive created script to set each frame rotation on SpriteRenderer to zero. Works for me.

public class YourObject: MonoBehaviour
{

public SpriteRenderer spriteRenderer;

void Awake()
{
spriteRenderer = GetComponent<SpriteRenderer>();
}

private void Update()
{
spriteRenderer.transform.rotation = Quaternion.identity;
}

}
`