Search Unity

Losing Shape with Polygon Collider 2D

Discussion in 'Editor & General Support' started by Vanz, Aug 19, 2014.

  1. Vanz

    Vanz

    Joined:
    Nov 19, 2013
    Posts:
    374
    Hi,

    When I'm using Polygon Collider 2D and rotating an object, the collider shape does not stick with my image, see below:



    Top pic is my tweaked Polygon Collider 2D shape, second pic is what Polygon Collider 2D shape looks like after about 60 - 90 degrees of rotation, what am I doing wrong?

    Here is the code for rotating the asteroid:

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4. public class Rotate_Object : MonoBehaviour {
    5. public float RotationSpeed;
    6. // Use this for initialization
    7. void Start () {
    8. }
    9. // Update is called once per frame
    10. void Update () {
    11. transform.Rotate(new Vector3(0,0,Time.deltaTime * RotationSpeed));
    12. }
    13. }
    14.  
    15.  
     
  2. Vanz

    Vanz

    Joined:
    Nov 19, 2013
    Posts:
    374
    Any ideas?
     
  3. Vanz

    Vanz

    Joined:
    Nov 19, 2013
    Posts:
    374
    Also, this asteroid is contained in another 2d quad that is blank, the quad in moving linearly...

    So in other words, I have a quad moving in a straight line, then this asteroid 2d quad underneath it rotating. Still can't see why the Polygon Collider 2D doesn't appear to rotate at the same angular velocity as the 2d sprite?