1 using System.Collections.Generic;
8 [AddComponentMenu(
"TrueSync/Physics/PolygonCollider2D", 0)]
12 private TSVector2[] _points;
14 public TSVector2[] points {
17 Physics2D.PolygonShape polygonShape = (Physics2D.PolygonShape)_body.FixtureList[0].Shape;
18 return polygonShape.Vertices.ToArray();
28 Physics2D.PolygonShape polygonShape = (Physics2D.PolygonShape)_body.FixtureList[0].Shape;
29 polygonShape.Vertices =
new Physics2D.Vertices(value);
38 if (_points == null || _points.Length == 0) {
44 TrueSync.Physics2D.Vertices v =
new Physics2D.Vertices();
45 for (
int index = 0, length = _points.Length; index < length; index++) {
46 v.Add(TSVector2.Scale(_points[index], lossy2D));
49 return new TrueSync.Physics2D.PolygonShape(v, 1);
53 TSVector2[] allPoints = _points;
55 if (allPoints == null || allPoints.Length == 0) {
59 for (
int index = 0, length = allPoints.Length - 1; index < length; index++) {
60 Gizmos.DrawLine(allPoints[index].ToVector(), allPoints[index+1].ToVector());
63 Gizmos.DrawLine(allPoints[allPoints.Length - 1].ToVector(), allPoints[0].ToVector());
FP y
The Y component of the vector.
override TrueSync.Physics2D.Shape CreateShape()
Create the internal shape used to represent a TSBoxCollider.
Collider with a polygon 2D shape.
override void DrawGizmos()
Draws the specific gizmos of concrete collider (for example "Gizmos.DrawWireCube" for a TSBoxCollider...
TSVector lossyScale
Holds an first value of the GameObject's lossy scale.
FP x
The X component of the vector.
override Vector3 GetGizmosSize()
Returns the gizmos size.
Abstract collider for 2D shapes.