8 [AddComponentMenu(
"TrueSync/Physics/BoxCollider", 0)]
11 [FormerlySerializedAs(
"size")]
13 private Vector3 _size = Vector3.one;
21 TSVector boxSize = ((BoxShape)_body.Shape).Size;
29 return _size.ToTSVector();
33 _size = value.ToVector();
46 if (GetComponent<BoxCollider2D>() != null) {
47 BoxCollider2D boxCollider2D = GetComponent<BoxCollider2D>();
49 size =
new TSVector(boxCollider2D.size.x, boxCollider2D.size.y, 1);
50 Center =
new TSVector(boxCollider2D.offset.x, boxCollider2D.offset.y, 0);
52 }
else if (GetComponent<BoxCollider>() != null) {
53 BoxCollider boxCollider = GetComponent<BoxCollider>();
55 size =
new TSVector(boxCollider.size.x, boxCollider.size.y, 1);
56 Center = boxCollider.center.ToTSVector();
69 Gizmos.DrawWireCube(Vector3.zero, Vector3.one);
FP y
The Y component of the vector.
Shape Shape
Shape used by a collider.
override Vector3 GetGizmosSize()
Returns the gizmos size.
override Shape CreateShape()
Create the internal shape used to represent a TSBoxCollider.
TSVector size
Size of the box.
bool isTrigger
If it is only a trigger and doesn't interfere on collisions.
void Scale(TSVector other)
Multiplies each component of the vector by the same components of the provided vector.
FP z
The Z component of the vector.
Abstract collider for 3D shapes.
Collider with a box shape.
void Reset()
Sets initial values to size based on a pre-existing BoxCollider or BoxCollider2D. ...
TSVector lossyScale
Holds an first value of the GameObject's lossy scale.
TSVector Center
Center of the collider shape.
FP x
The X component of the vector.
override void DrawGizmos()
Draws the specific gizmos of concrete collider (for example "Gizmos.DrawWireCube" for a TSBoxCollider...