public FPPolygonalCollider AddPolygonalCollider(Vector2[] vertices, bool withDebugView = false) { FPPolygonalCollider fp = gameObject.AddComponent <FPPolygonalCollider>(); fp.Init(new FPPolygonalData(vertices, false)); if (withDebugView) { FPDebugRenderer.Create(gameObject, Futile.stage, 0x00FF00, false); } return(fp); }
public SphereCollider AddSphereCollider(float radius, bool withDebugView = false) { SphereCollider sc = gameObject.AddComponent <SphereCollider>(); sc.radius = radius * FPhysics.POINTS_TO_METERS; if (withDebugView) { FPDebugRenderer.Create(gameObject, Futile.stage, 0x00FF00, false); } return(sc); }
public BoxCollider AddBoxCollider(Vector2 size, bool withDebugView = false) { BoxCollider bc = gameObject.AddComponent <BoxCollider>(); bc.size = new Vector3(size.x * FPhysics.POINTS_TO_METERS, size.y * FPhysics.POINTS_TO_METERS, FPhysics.DEFAULT_Z_THICKNESS); if (withDebugView) { FPDebugRenderer.Create(gameObject, Futile.stage, 0x00FF00, false); } return(bc); }