public void DrawShape(cpShape shape) { cpBody body = shape.body; cpColor color = cp.GetShapeColor(shape);; // ColorForBody(body); switch (shape.shapeType) { case cpShapeType.Circle: { cpCircleShape circle = (cpCircleShape)shape; if (Flags.HasFlag(PhysicsDrawFlags.BB) || Flags.HasFlag(PhysicsDrawFlags.All)) { Draw(circle.bb); } if (Flags.HasFlag(PhysicsDrawFlags.Shapes) || Flags.HasFlag(PhysicsDrawFlags.All)) { Draw(circle, color); } } break; case cpShapeType.Segment: { cpSegmentShape seg = (cpSegmentShape)shape; if (Flags.HasFlag(PhysicsDrawFlags.BB) || Flags.HasFlag(PhysicsDrawFlags.All)) { Draw(seg.bb); } if (Flags.HasFlag(PhysicsDrawFlags.Shapes) || Flags.HasFlag(PhysicsDrawFlags.All)) { Draw(seg, color); } } break; case cpShapeType.Polygon: { cpPolyShape poly = (cpPolyShape)shape; if (Flags.HasFlag(PhysicsDrawFlags.BB) || Flags.HasFlag(PhysicsDrawFlags.All)) { Draw(poly.bb); } if (Flags.HasFlag(PhysicsDrawFlags.Shapes) || Flags.HasFlag(PhysicsDrawFlags.All)) { Draw(poly, color); } } break; default: cp.AssertHard(false, "Bad assertion in DrawShape()"); break; } }
public void Draw(cpCircleShape circle, cpColor color) { cpVect center = circle.tc; float radius = circle.r; cpVect To = cpVect.cpvadd(cpVect.cpvmult(circle.body.GetRotation(), circle.r), (circle.tc)); DrawCircle(center, cp.cpfmax(radius, 1.0f), color); DrawSegment(center, To, 0.5f, cpColor.Grey); }
public CCPhysicsShapeCircle(CCPhysicsMaterial material, float radius, CCPoint offset) { _type = PhysicsType.CIRCLE; cpShape shape = new cpCircleShape(CCPhysicsShapeInfo.SharedBody, radius, PhysicsHelper.CCPointToCpVect(offset)); _info.Add(shape); _area = CalculateArea(); _mass = material.density == cp.Infinity ? cp.Infinity : material.density * _area; _moment = CalculateDefaultMoment(); Material = material; }
public CCPhysicsShapeCircle(CCPhysicsMaterial material, float radius, cpVect offset) { _type = PhysicsType.CIRCLE; cpShape shape = new cpCircleShape(CCPhysicsShapeInfo.getSharedBody(), radius, offset); _info.add(shape); _area = CalculateArea(); _mass = material.density == cp.Infinity ? cp.Infinity : material.density * _area; _moment = CalculateDefaultMoment(); SetMaterial(material); }
public static SupportPoint CircleSupportPoint(cpCircleShape circle, cpVect n) { return(new SupportPoint(circle.tc, 0)); }
public ChipmunkBody(cpCircleShape shape, bool isStatic) { Instance = shape; IsStatic = isStatic; }