RID Physics2DServerSW::shape_create(ShapeType p_shape) { Shape2DSW *shape = NULL; switch (p_shape) { case SHAPE_LINE: { shape = memnew(LineShape2DSW); } break; case SHAPE_RAY: { shape = memnew(RayShape2DSW); } break; case SHAPE_SEGMENT: { shape = memnew(SegmentShape2DSW); } break; case SHAPE_CIRCLE: { shape = memnew(CircleShape2DSW); } break; case SHAPE_RECTANGLE: { shape = memnew(RectangleShape2DSW); } break; case SHAPE_CAPSULE: { shape = memnew(CapsuleShape2DSW); } break; case SHAPE_CONVEX_POLYGON: { shape = memnew(ConvexPolygonShape2DSW); } break; case SHAPE_CONCAVE_POLYGON: { shape = memnew(ConcavePolygonShape2DSW); } break; case SHAPE_CUSTOM: { ERR_FAIL_V(RID()); } break; } RID id = shape_owner.make_rid(shape); shape->set_self(id); return id; };