private Vector2D ShapeCenter(IPhysicsShape shape) { if (shape != null) { switch (shape.ShapeType) { case ShapeType.Rectangle: var shapeRectangle = (RectangleShape)shape; return(shapeRectangle.Position + shapeRectangle.Size / 2d); case ShapeType.Point: var shapePoint = (PointShape)shape; return(shapePoint.Point); case ShapeType.Circle: var shapeCircle = (CircleShape)shape; return(shapeCircle.Center); case ShapeType.Line: break; case ShapeType.LineSegment: var lineSegmentShape = (LineSegmentShape)shape; return(new Vector2D((lineSegmentShape.Point1.X + lineSegmentShape.Point2.X) / 2d, (lineSegmentShape.Point1.Y + lineSegmentShape.Point2.Y) / 2d)); default: throw new ArgumentOutOfRangeException(); } } return(new Vector2D(0, 0)); }
public static void ServerSendDebugPhysicsTesting(IPhysicsShape physicsShape) { var wrappedShape = PhysicsShapeRemoteDataHelper.Wrap(physicsShape); var allPlayers = Server.Characters.EnumerateAllPlayerCharacters(onlyOnline: true, exceptSpectators: false); instance.CallClient( allPlayers, _ => _.ClientRemote_ProcessServerDebugPhysicsTesting(wrappedShape)); }
internal static void SetObjects(Dictionary <string, object> objects) { EngineApplicationInterface._objects = objects; EngineApplicationInterface.IPath = EngineApplicationInterface.GetObject <IPath>(); EngineApplicationInterface.IShader = EngineApplicationInterface.GetObject <IShader>(); EngineApplicationInterface.ITexture = EngineApplicationInterface.GetObject <ITexture>(); EngineApplicationInterface.IMaterial = EngineApplicationInterface.GetObject <IMaterial>(); EngineApplicationInterface.IMetaMesh = EngineApplicationInterface.GetObject <IMetaMesh>(); EngineApplicationInterface.IDecal = EngineApplicationInterface.GetObject <IDecal>(); EngineApplicationInterface.IClothSimulatorComponent = EngineApplicationInterface.GetObject <IClothSimulatorComponent>(); EngineApplicationInterface.ICompositeComponent = EngineApplicationInterface.GetObject <ICompositeComponent>(); EngineApplicationInterface.IPhysicsShape = EngineApplicationInterface.GetObject <IPhysicsShape>(); EngineApplicationInterface.IBodyPart = EngineApplicationInterface.GetObject <IBodyPart>(); EngineApplicationInterface.IMesh = EngineApplicationInterface.GetObject <IMesh>(); EngineApplicationInterface.IMeshBuilder = EngineApplicationInterface.GetObject <IMeshBuilder>(); EngineApplicationInterface.ICamera = EngineApplicationInterface.GetObject <ICamera>(); EngineApplicationInterface.ISkeleton = EngineApplicationInterface.GetObject <ISkeleton>(); EngineApplicationInterface.IGameEntity = EngineApplicationInterface.GetObject <IGameEntity>(); EngineApplicationInterface.IGameEntityComponent = EngineApplicationInterface.GetObject <IGameEntityComponent>(); EngineApplicationInterface.IScene = EngineApplicationInterface.GetObject <IScene>(); EngineApplicationInterface.IScriptComponent = EngineApplicationInterface.GetObject <IScriptComponent>(); EngineApplicationInterface.ILight = EngineApplicationInterface.GetObject <ILight>(); EngineApplicationInterface.IParticleSystem = EngineApplicationInterface.GetObject <IParticleSystem>(); EngineApplicationInterface.IPhysicsMaterial = EngineApplicationInterface.GetObject <IPhysicsMaterial>(); EngineApplicationInterface.ISceneView = EngineApplicationInterface.GetObject <ISceneView>(); EngineApplicationInterface.IView = EngineApplicationInterface.GetObject <IView>(); EngineApplicationInterface.ITableauView = EngineApplicationInterface.GetObject <ITableauView>(); EngineApplicationInterface.ITextureView = EngineApplicationInterface.GetObject <ITextureView>(); EngineApplicationInterface.IVideoPlayerView = EngineApplicationInterface.GetObject <IVideoPlayerView>(); EngineApplicationInterface.IThumbnailCreatorView = EngineApplicationInterface.GetObject <IThumbnailCreatorView>(); EngineApplicationInterface.IDebug = EngineApplicationInterface.GetObject <IDebug>(); EngineApplicationInterface.ITwoDimensionView = EngineApplicationInterface.GetObject <ITwoDimensionView>(); EngineApplicationInterface.IUtil = EngineApplicationInterface.GetObject <IUtil>(); EngineApplicationInterface.IEngineSizeChecker = EngineApplicationInterface.GetObject <IEngineSizeChecker>(); EngineApplicationInterface.IInput = EngineApplicationInterface.GetObject <IInput>(); EngineApplicationInterface.ITime = EngineApplicationInterface.GetObject <ITime>(); EngineApplicationInterface.IScreen = EngineApplicationInterface.GetObject <IScreen>(); EngineApplicationInterface.IMusic = EngineApplicationInterface.GetObject <IMusic>(); EngineApplicationInterface.IImgui = EngineApplicationInterface.GetObject <IImgui>(); EngineApplicationInterface.IMouseManager = EngineApplicationInterface.GetObject <IMouseManager>(); EngineApplicationInterface.IHighlights = EngineApplicationInterface.GetObject <IHighlights>(); EngineApplicationInterface.ISoundEvent = EngineApplicationInterface.GetObject <ISoundEvent>(); EngineApplicationInterface.ISoundManager = EngineApplicationInterface.GetObject <ISoundManager>(); EngineApplicationInterface.IConfig = EngineApplicationInterface.GetObject <IConfig>(); EngineApplicationInterface.IManagedMeshEditOperations = EngineApplicationInterface.GetObject <IManagedMeshEditOperations>(); }
public static BasePhysicsShapeRemoteData Wrap(IPhysicsShape shape) { switch (shape.ShapeType) { case ShapeType.Circle: return(new CircleShapeRemoteData((CircleShape)shape)); case ShapeType.Rectangle: return(new RectangleShapeRemoteData((RectangleShape)shape)); case ShapeType.Line: return(new LineShapeRemoteData((LineShape)shape)); case ShapeType.LineSegment: return(new LineSegmentShapeRemoteData((LineSegmentShape)shape)); case ShapeType.Point: return(new PointShapeRemoteData((PointShape)shape)); default: throw new ArgumentOutOfRangeException("Unknown shape type: " + shape.GetType().Name); } }
protected BasePhysicsShapeRemoteData(IPhysicsShape shape) { this.CollisionGroupId = CollisionGroups.GetCollisionGroupId(shape.CollisionGroup); }
public DynamicBodyComponent(IPhysicsShape shape) { Shape = shape; }
public TriggerBodyComponent(IPhysicsShape shape) { Shape = shape; }
public StaticBodyComponent(IPhysicsShape shape) { Shape = shape; }