Esempio n. 1
0
        void IPhysicsWorld.AddPolygon(
            Entity entity,
            bool isStatic,
            Common.Core.Numerics.Vector2 originWS,
            float rotation,
            Common.Core.Numerics.Vector2[] vertices,
            float density = 1)
        {
            var shape = this._world.CreatePolygonBodySpace(
                ToVolt(vertices),
                density);

            this._entityToBody[entity] = CreateBody(isStatic, originWS, rotation, shape);
        }
Esempio n. 2
0
 private VoltBody CreateBody(
     bool isStatic,
     Common.Core.Numerics.Vector2 originWS,
     float rotation,
     VoltShape shape)
 {
     if (isStatic)
     {
         return(this._world.CreateStaticBody(ToVolt(originWS), rotation, new VoltShape[] { shape }));
     }
     else
     {
         return(this._world.CreateDynamicBody(ToVolt(originWS), rotation, new VoltShape[] { shape }));
     }
 }
Esempio n. 3
0
        void IPhysicsWorld.AddCircle(
            Entity entity,
            bool isStatic,
            Common.Core.Numerics.Vector2 originWS,
            float rotation,
            float radius,
            float density = 1)
        {
            var shape = this._world.CreateCircleWorldSpace(
                ToVolt(originWS),
                radius,
                density);

            this._entityToBody[entity] = CreateBody(isStatic, originWS, rotation, shape);
        }
Esempio n. 4
0
 private static Volatile.Vector2 ToVolt(Common.Core.Numerics.Vector2 vector)
 {
     return(new Volatile.Vector2(vector.x, vector.y));
 }