8 [AddComponentMenu(
"TrueSync/Physics/CircleCollider2D", 0)]
11 [FormerlySerializedAs(
"radius")]
13 private FP _radius = 0.5f;
21 return ((Physics2D.CircleShape) _body.FixtureList[0].Shape).Radius;
30 Physics2D.CircleShape cShape = (Physics2D.CircleShape) _body.FixtureList[0].Shape;
31 if (cShape.Radius != _radius) {
32 cShape.Radius = _radius;
42 if (GetComponent<CircleCollider2D>() != null) {
43 CircleCollider2D circleCollider2D = GetComponent<CircleCollider2D>();
45 radius = circleCollider2D.radius;
46 Center =
new TSVector2(circleCollider2D.offset.x, circleCollider2D.offset.y);
48 }
else if (GetComponent<SphereCollider>() != null) {
49 SphereCollider sphereCollider = GetComponent<SphereCollider>();
51 radius = sphereCollider.radius;
52 Center = sphereCollider.center.ToTSVector2();
65 Gizmos.DrawWireSphere(Vector3.zero, 1);
69 return Vector3.one *
radius.AsFloat();
bool isTrigger
If it is only a trigger and doesn't interfere on collisions.
override TrueSync.Physics2D.Shape CreateShape()
Create the internal shape used to represent a TSSphereCollider.
override Vector3 GetGizmosSize()
Returns the gizmos size.
void Reset()
Sets initial values to radius based on a pre-existing SphereCollider or CircleCollider2D.
TSVector2 Center
Center of the collider shape.
Collider with a circle shape.
FP radius
Radius of the sphere.
Abstract collider for 2D shapes.
override void DrawGizmos()
Draws the specific gizmos of concrete collider (for example "Gizmos.DrawWireCube" for a TSBoxCollider...