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); }
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 })); } }
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); }
private static Volatile.Vector2 ToVolt(Common.Core.Numerics.Vector2 vector) { return(new Volatile.Vector2(vector.x, vector.y)); }