8 [AddComponentMenu(
"TrueSync/Physics/SphereCollider", 0)]
11 [FormerlySerializedAs(
"radius")]
13 private float _radius;
21 return ((SphereShape)_body.Shape).Radius;
28 _radius = value.AsFloat();
31 ((SphereShape)_body.Shape).Radius = value;
40 if (GetComponent<CircleCollider2D>() != null) {
41 CircleCollider2D circleCollider2D = GetComponent<CircleCollider2D>();
43 radius = circleCollider2D.radius;
44 Center =
new TSVector(circleCollider2D.offset.x, circleCollider2D.offset.y, 0);
46 }
else if (GetComponent<SphereCollider>() != null) {
47 SphereCollider sphereCollider = GetComponent<SphereCollider>();
49 radius = sphereCollider.radius;
50 Center = sphereCollider.center.ToTSVector();
59 return new SphereShape(
radius);
63 Gizmos.DrawWireSphere(Vector3.zero, 1);
67 return Vector3.one *
radius.AsFloat();
Shape Shape
Shape used by a collider.
override void DrawGizmos()
Draws the specific gizmos of concrete collider (for example "Gizmos.DrawWireCube" for a TSBoxCollider...
Collider with a sphere shape.
bool isTrigger
If it is only a trigger and doesn't interfere on collisions.
Abstract collider for 3D shapes.
void Reset()
Sets initial values to radius based on a pre-existing SphereCollider or CircleCollider2D.
TSVector Center
Center of the collider shape.
override Shape CreateShape()
Create the internal shape used to represent a TSSphereCollider.
override Vector3 GetGizmosSize()
Returns the gizmos size.
FP radius
Radius of the sphere.