Exemple #1
0
        //public abstract bool LineOfSight(LVector3 start, LVector3 end);

        public virtual int AddBody(ICollisionBody body, AABB2D *ptr, LVector2 pos, LVector2 extents)
        {
            var refId = _uniqueIndex++;

            *ptr = new AABB2D(refId, pos, extents);
            _id2Ptr[refId]  = (long)ptr;
            _id2Body[refId] = body;
            _shapePtrs.Add((long)ptr);
            return(refId);
        }
Exemple #2
0
        public static void DrawAABB(AABB2D aabb, Color color)
        {
            var right = aabb.size.x * LVector2.right;
            var up    = aabb.size.y * LVector2.up;
            var lb    = aabb.pos - up - right;
            var lt    = aabb.pos + up - right;
            var rt    = aabb.pos + up + right;
            var rb    = aabb.pos - up + right;

            Debug.DrawLine(lb.ToVector2(), lt.ToVector2(), color);
            Debug.DrawLine(lt.ToVector2(), rt.ToVector2(), color);
            Debug.DrawLine(rt.ToVector2(), rb.ToVector2(), color);
            Debug.DrawLine(rb.ToVector2(), lb.ToVector2(), color);
        }
Exemple #3
0
 void ShowShape(ref AABB2D aabb, int idx)
 {
     ShowShape(ref aabb, idx, DrawProperty);
 }
Exemple #4
0
 public static void DrawProperty(ref AABB2D shape)
 {
     shape.size = EditorGUILayoutExt.Vector2Field("Size", shape.size);
 }