9 [AddComponentMenu(
"TrueSync/Physics/SphereCollider", 0)]
12 [FormerlySerializedAs(
"radius")]
14 private float _radius;
22 return ((SphereShape)_body.Shape).Radius;
29 _radius = value.AsFloat();
32 ((SphereShape)_body.Shape).Radius = value;
41 if (GetComponent<CircleCollider2D>() != null) {
42 CircleCollider2D circleCollider2D = GetComponent<CircleCollider2D>();
44 radius = circleCollider2D.radius;
45 Center =
new TSVector(circleCollider2D.offset.x, circleCollider2D.offset.y, 0);
47 }
else if (GetComponent<SphereCollider>() != null) {
48 SphereCollider sphereCollider = GetComponent<SphereCollider>();
50 radius = sphereCollider.radius;
51 Center = sphereCollider.center.ToTSVector();
60 return new SphereShape(
radius);
64 Gizmos.DrawWireSphere(Vector3.zero, 1);
68 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.