excalibur 0.25.2 → 0.25.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -2
- package/build/dist/Actions/Action/Blink.js +51 -0
- package/build/dist/Actions/Action/Blink.js.map +1 -0
- package/build/dist/Actions/Action/CallMethod.js +21 -0
- package/build/dist/Actions/Action/CallMethod.js.map +1 -0
- package/build/dist/Actions/Action/Delay.js +25 -0
- package/build/dist/Actions/Action/Delay.js.map +1 -0
- package/build/dist/Actions/Action/Die.js +22 -0
- package/build/dist/Actions/Action/Die.js.map +1 -0
- package/build/dist/Actions/Action/EaseTo.js +69 -0
- package/build/dist/Actions/Action/EaseTo.js.map +1 -0
- package/build/dist/Actions/Action/Fade.js +46 -0
- package/build/dist/Actions/Action/Fade.js.map +1 -0
- package/build/dist/Actions/Action/Follow.js +55 -0
- package/build/dist/Actions/Action/Follow.js.map +1 -0
- package/build/dist/Actions/Action/Meet.js +52 -0
- package/build/dist/Actions/Action/Meet.js.map +1 -0
- package/build/dist/Actions/Action/MoveBy.js +47 -0
- package/build/dist/Actions/Action/MoveBy.js.map +1 -0
- package/build/dist/Actions/Action/MoveTo.js +40 -0
- package/build/dist/Actions/Action/MoveTo.js.map +1 -0
- package/build/dist/Actions/Action/Repeat.js +31 -0
- package/build/dist/Actions/Action/Repeat.js.map +1 -0
- package/build/dist/Actions/Action/RepeatForever.js +37 -0
- package/build/dist/Actions/Action/RepeatForever.js.map +1 -0
- package/build/dist/Actions/Action/RotateBy.js +91 -0
- package/build/dist/Actions/Action/RotateBy.js.map +1 -0
- package/build/dist/Actions/Action/RotateTo.js +90 -0
- package/build/dist/Actions/Action/RotateTo.js.map +1 -0
- package/build/dist/Actions/Action/ScaleBy.js +45 -0
- package/build/dist/Actions/Action/ScaleBy.js.map +1 -0
- package/build/dist/Actions/Action/ScaleTo.js +56 -0
- package/build/dist/Actions/Action/ScaleTo.js.map +1 -0
- package/build/dist/Actions/Action.js +2 -0
- package/build/dist/Actions/Action.js.map +1 -0
- package/build/dist/Actions/ActionContext.js +305 -0
- package/build/dist/Actions/ActionContext.js.map +1 -0
- package/build/dist/Actions/ActionQueue.js +87 -0
- package/build/dist/Actions/ActionQueue.js.map +1 -0
- package/build/dist/Actions/Actionable.js +2 -0
- package/build/dist/Actions/Actionable.js.map +1 -0
- package/build/dist/Actions/ActionsComponent.js +198 -0
- package/build/dist/Actions/ActionsComponent.js.map +1 -0
- package/build/dist/Actions/ActionsSystem.js +18 -0
- package/build/dist/Actions/ActionsSystem.js.map +1 -0
- package/build/dist/Actions/Index.js +22 -0
- package/build/dist/Actions/Index.js.map +1 -0
- package/build/dist/Actions/RotationType.js +27 -0
- package/build/dist/Actions/RotationType.js.map +1 -0
- package/build/dist/Actor.js +831 -0
- package/build/dist/Actor.js.map +1 -0
- package/build/dist/Camera.js +663 -0
- package/build/dist/Camera.js.map +1 -0
- package/build/dist/Class.js +48 -0
- package/build/dist/Class.js.map +1 -0
- package/build/dist/Collision/BodyComponent.js +351 -0
- package/build/dist/Collision/BodyComponent.js.map +1 -0
- package/build/dist/Collision/BoundingBox.js +361 -0
- package/build/dist/Collision/BoundingBox.js.map +1 -0
- package/build/dist/Collision/ColliderComponent.js +198 -0
- package/build/dist/Collision/ColliderComponent.js.map +1 -0
- package/build/dist/Collision/Colliders/CircleCollider.js +264 -0
- package/build/dist/Collision/Colliders/CircleCollider.js.map +1 -0
- package/build/dist/Collision/Colliders/ClosestLineJumpTable.js +211 -0
- package/build/dist/Collision/Colliders/ClosestLineJumpTable.js.map +1 -0
- package/build/dist/Collision/Colliders/Collider.js +26 -0
- package/build/dist/Collision/Colliders/Collider.js.map +1 -0
- package/build/dist/Collision/Colliders/CollisionJumpTable.js +301 -0
- package/build/dist/Collision/Colliders/CollisionJumpTable.js.map +1 -0
- package/build/dist/Collision/Colliders/CompositeCollider.js +232 -0
- package/build/dist/Collision/Colliders/CompositeCollider.js.map +1 -0
- package/build/dist/Collision/Colliders/EdgeCollider.js +253 -0
- package/build/dist/Collision/Colliders/EdgeCollider.js.map +1 -0
- package/build/dist/Collision/Colliders/PolygonCollider.js +389 -0
- package/build/dist/Collision/Colliders/PolygonCollider.js.map +1 -0
- package/build/dist/Collision/Colliders/SeparatingAxis.js +67 -0
- package/build/dist/Collision/Colliders/SeparatingAxis.js.map +1 -0
- package/build/dist/Collision/Colliders/Shape.js +102 -0
- package/build/dist/Collision/Colliders/Shape.js.map +1 -0
- package/build/dist/Collision/CollisionSystem.js +116 -0
- package/build/dist/Collision/CollisionSystem.js.map +1 -0
- package/build/dist/Collision/CollisionType.js +33 -0
- package/build/dist/Collision/CollisionType.js.map +1 -0
- package/build/dist/Collision/Detection/CollisionContact.js +46 -0
- package/build/dist/Collision/Detection/CollisionContact.js.map +1 -0
- package/build/dist/Collision/Detection/CollisionProcessor.js +2 -0
- package/build/dist/Collision/Detection/CollisionProcessor.js.map +1 -0
- package/build/dist/Collision/Detection/DynamicTree.js +442 -0
- package/build/dist/Collision/Detection/DynamicTree.js.map +1 -0
- package/build/dist/Collision/Detection/DynamicTreeCollisionProcessor.js +211 -0
- package/build/dist/Collision/Detection/DynamicTreeCollisionProcessor.js.map +1 -0
- package/build/dist/Collision/Detection/Pair.js +92 -0
- package/build/dist/Collision/Detection/Pair.js.map +1 -0
- package/build/dist/Collision/Group/CollisionGroup.js +114 -0
- package/build/dist/Collision/Group/CollisionGroup.js.map +1 -0
- package/build/dist/Collision/Group/CollisionGroupManager.js +52 -0
- package/build/dist/Collision/Group/CollisionGroupManager.js.map +1 -0
- package/build/dist/Collision/Index.js +29 -0
- package/build/dist/Collision/Index.js.map +1 -0
- package/build/dist/Collision/Integrator.js +11 -0
- package/build/dist/Collision/Integrator.js.map +1 -0
- package/build/dist/Collision/MotionSystem.js +42 -0
- package/build/dist/Collision/MotionSystem.js.map +1 -0
- package/build/dist/Collision/Physics.js +163 -0
- package/build/dist/Collision/Physics.js.map +1 -0
- package/build/dist/Collision/Side.js +51 -0
- package/build/dist/Collision/Side.js.map +1 -0
- package/build/dist/Collision/Solver/ArcadeSolver.js +101 -0
- package/build/dist/Collision/Solver/ArcadeSolver.js.map +1 -0
- package/build/dist/Collision/Solver/ContactConstraintPoint.js +83 -0
- package/build/dist/Collision/Solver/ContactConstraintPoint.js.map +1 -0
- package/build/dist/Collision/Solver/RealisticSolver.js +248 -0
- package/build/dist/Collision/Solver/RealisticSolver.js.map +1 -0
- package/build/dist/Collision/Solver/Solver.js +37 -0
- package/build/dist/Collision/Solver/Solver.js.map +1 -0
- package/build/dist/Color.js +461 -0
- package/build/dist/Color.js.map +1 -0
- package/build/dist/Configurable.js +32 -0
- package/build/dist/Configurable.js.map +1 -0
- package/build/dist/Debug/Debug.js +375 -0
- package/build/dist/Debug/Debug.js.map +1 -0
- package/build/dist/Debug/DebugFlags.js +40 -0
- package/build/dist/Debug/DebugFlags.js.map +1 -0
- package/build/dist/Debug/DebugSystem.js +251 -0
- package/build/dist/Debug/DebugSystem.js.map +1 -0
- package/build/dist/Debug/index.js +4 -0
- package/build/dist/Debug/index.js.map +1 -0
- package/build/dist/Deprecated.js +2 -0
- package/build/dist/Deprecated.js.map +1 -0
- package/build/dist/Drawing/Animation.js +294 -0
- package/build/dist/Drawing/Animation.js.map +1 -0
- package/build/dist/Drawing/CanvasDrawComponent.js +16 -0
- package/build/dist/Drawing/CanvasDrawComponent.js.map +1 -0
- package/build/dist/Drawing/CanvasDrawingSystem.js +95 -0
- package/build/dist/Drawing/CanvasDrawingSystem.js.map +1 -0
- package/build/dist/Drawing/Index.js +10 -0
- package/build/dist/Drawing/Index.js.map +1 -0
- package/build/dist/Drawing/Polygon.js +139 -0
- package/build/dist/Drawing/Polygon.js.map +1 -0
- package/build/dist/Drawing/Sprite.js +355 -0
- package/build/dist/Drawing/Sprite.js.map +1 -0
- package/build/dist/Drawing/SpriteEffects.js +246 -0
- package/build/dist/Drawing/SpriteEffects.js.map +1 -0
- package/build/dist/Drawing/SpriteSheet.js +413 -0
- package/build/dist/Drawing/SpriteSheet.js.map +1 -0
- package/build/dist/Drawing/Texture.js +69 -0
- package/build/dist/Drawing/Texture.js.map +1 -0
- package/build/dist/Engine.d.ts +4 -1
- package/build/dist/Engine.js +985 -0
- package/build/dist/Engine.js.map +1 -0
- package/build/dist/EntityComponentSystem/Component.js +65 -0
- package/build/dist/EntityComponentSystem/Component.js.map +1 -0
- package/build/dist/EntityComponentSystem/Components/MotionComponent.js +33 -0
- package/build/dist/EntityComponentSystem/Components/MotionComponent.js.map +1 -0
- package/build/dist/EntityComponentSystem/Components/TransformComponent.js +249 -0
- package/build/dist/EntityComponentSystem/Components/TransformComponent.js.map +1 -0
- package/build/dist/EntityComponentSystem/Entity.js +452 -0
- package/build/dist/EntityComponentSystem/Entity.js.map +1 -0
- package/build/dist/EntityComponentSystem/EntityManager.js +128 -0
- package/build/dist/EntityComponentSystem/EntityManager.js.map +1 -0
- package/build/dist/EntityComponentSystem/Query.js +91 -0
- package/build/dist/EntityComponentSystem/Query.js.map +1 -0
- package/build/dist/EntityComponentSystem/QueryManager.js +90 -0
- package/build/dist/EntityComponentSystem/QueryManager.js.map +1 -0
- package/build/dist/EntityComponentSystem/System.js +76 -0
- package/build/dist/EntityComponentSystem/System.js.map +1 -0
- package/build/dist/EntityComponentSystem/SystemManager.js +102 -0
- package/build/dist/EntityComponentSystem/SystemManager.js.map +1 -0
- package/build/dist/EntityComponentSystem/Util.js +5 -0
- package/build/dist/EntityComponentSystem/Util.js.map +1 -0
- package/build/dist/EntityComponentSystem/World.js +55 -0
- package/build/dist/EntityComponentSystem/World.js.map +1 -0
- package/build/dist/EntityComponentSystem/index.js +11 -0
- package/build/dist/EntityComponentSystem/index.js.map +1 -0
- package/build/dist/EventDispatcher.js +114 -0
- package/build/dist/EventDispatcher.js.map +1 -0
- package/build/dist/Events/ExEvent.js +12 -0
- package/build/dist/Events/ExEvent.js.map +1 -0
- package/build/dist/Events/MediaEvents.js +75 -0
- package/build/dist/Events/MediaEvents.js.map +1 -0
- package/build/dist/Events/PointerEvents.js +52 -0
- package/build/dist/Events/PointerEvents.js.map +1 -0
- package/build/dist/Events.js +497 -0
- package/build/dist/Events.js.map +1 -0
- package/build/dist/Flags.js +90 -0
- package/build/dist/Flags.js.map +1 -0
- package/build/dist/Graphics/Animation.js +310 -0
- package/build/dist/Graphics/Animation.js.map +1 -0
- package/build/dist/Graphics/Canvas.js +38 -0
- package/build/dist/Graphics/Canvas.js.map +1 -0
- package/build/dist/Graphics/Circle.js +47 -0
- package/build/dist/Graphics/Circle.js.map +1 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext.js +2 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext.js.map +1 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext2DCanvas.js +207 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContext2DCanvas.js.map +1 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContextWebGL.js +331 -0
- package/build/dist/Graphics/Context/ExcaliburGraphicsContextWebGL.js.map +1 -0
- package/build/dist/Graphics/Context/circle-renderer/circle-renderer.js +160 -0
- package/build/dist/Graphics/Context/circle-renderer/circle-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/debug-text.js +47 -0
- package/build/dist/Graphics/Context/debug-text.js.map +1 -0
- package/build/dist/Graphics/Context/image-renderer/image-renderer.js +209 -0
- package/build/dist/Graphics/Context/image-renderer/image-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/line-renderer/line-renderer.js +87 -0
- package/build/dist/Graphics/Context/line-renderer/line-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/point-renderer/point-renderer.js +82 -0
- package/build/dist/Graphics/Context/point-renderer/point-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/quad-index-buffer.js +69 -0
- package/build/dist/Graphics/Context/quad-index-buffer.js.map +1 -0
- package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.js +272 -0
- package/build/dist/Graphics/Context/rectangle-renderer/rectangle-renderer.js.map +1 -0
- package/build/dist/Graphics/Context/render-source.js +16 -0
- package/build/dist/Graphics/Context/render-source.js.map +1 -0
- package/build/dist/Graphics/Context/render-target.js +65 -0
- package/build/dist/Graphics/Context/render-target.js.map +1 -0
- package/build/dist/Graphics/Context/renderer.js +2 -0
- package/build/dist/Graphics/Context/renderer.js.map +1 -0
- package/build/dist/Graphics/Context/screen-pass-painter/screen-pass-painter.js +53 -0
- package/build/dist/Graphics/Context/screen-pass-painter/screen-pass-painter.js.map +1 -0
- package/build/dist/Graphics/Context/shader.js +236 -0
- package/build/dist/Graphics/Context/shader.js.map +1 -0
- package/build/dist/Graphics/Context/state-stack.js +27 -0
- package/build/dist/Graphics/Context/state-stack.js.map +1 -0
- package/build/dist/Graphics/Context/texture-loader.d.ts +8 -0
- package/build/dist/Graphics/Context/texture-loader.js +121 -0
- package/build/dist/Graphics/Context/texture-loader.js.map +1 -0
- package/build/dist/Graphics/Context/transform-stack.js +30 -0
- package/build/dist/Graphics/Context/transform-stack.js.map +1 -0
- package/build/dist/Graphics/Context/vertex-buffer.js +45 -0
- package/build/dist/Graphics/Context/vertex-buffer.js.map +1 -0
- package/build/dist/Graphics/Context/vertex-layout.js +93 -0
- package/build/dist/Graphics/Context/vertex-layout.js.map +1 -0
- package/build/dist/Graphics/Context/webgl-adapter.js +19 -0
- package/build/dist/Graphics/Context/webgl-adapter.js.map +1 -0
- package/build/dist/Graphics/Context/webgl-util.js +105 -0
- package/build/dist/Graphics/Context/webgl-util.js.map +1 -0
- package/build/dist/Graphics/DebugGraphicsComponent.js +15 -0
- package/build/dist/Graphics/DebugGraphicsComponent.js.map +1 -0
- package/build/dist/Graphics/Filtering.js +17 -0
- package/build/dist/Graphics/Filtering.js.map +1 -0
- package/build/dist/Graphics/Font.js +293 -0
- package/build/dist/Graphics/Font.js.map +1 -0
- package/build/dist/Graphics/FontCommon.js +109 -0
- package/build/dist/Graphics/FontCommon.js.map +1 -0
- package/build/dist/Graphics/Graphic.js +200 -0
- package/build/dist/Graphics/Graphic.js.map +1 -0
- package/build/dist/Graphics/GraphicsComponent.js +290 -0
- package/build/dist/Graphics/GraphicsComponent.js.map +1 -0
- package/build/dist/Graphics/GraphicsDiagnostics.js +9 -0
- package/build/dist/Graphics/GraphicsDiagnostics.js.map +1 -0
- package/build/dist/Graphics/GraphicsGroup.js +69 -0
- package/build/dist/Graphics/GraphicsGroup.js.map +1 -0
- package/build/dist/Graphics/GraphicsSystem.js +153 -0
- package/build/dist/Graphics/GraphicsSystem.js.map +1 -0
- package/build/dist/Graphics/ImageSource.js +116 -0
- package/build/dist/Graphics/ImageSource.js.map +1 -0
- package/build/dist/Graphics/Polygon.js +59 -0
- package/build/dist/Graphics/Polygon.js.map +1 -0
- package/build/dist/Graphics/PostProcessor/ColorBlindnessMode.js +7 -0
- package/build/dist/Graphics/PostProcessor/ColorBlindnessMode.js.map +1 -0
- package/build/dist/Graphics/PostProcessor/ColorBlindnessPostProcessor.js +52 -0
- package/build/dist/Graphics/PostProcessor/ColorBlindnessPostProcessor.js.map +1 -0
- package/build/dist/Graphics/PostProcessor/PostProcessor.js +2 -0
- package/build/dist/Graphics/PostProcessor/PostProcessor.js.map +1 -0
- package/build/dist/Graphics/PostProcessor/ScreenShader.js +56 -0
- package/build/dist/Graphics/PostProcessor/ScreenShader.js.map +1 -0
- package/build/dist/Graphics/Raster.js +207 -0
- package/build/dist/Graphics/Raster.js.map +1 -0
- package/build/dist/Graphics/Rectangle.js +29 -0
- package/build/dist/Graphics/Rectangle.js.map +1 -0
- package/build/dist/Graphics/Sprite.js +103 -0
- package/build/dist/Graphics/Sprite.js.map +1 -0
- package/build/dist/Graphics/SpriteFont.js +120 -0
- package/build/dist/Graphics/SpriteFont.js.map +1 -0
- package/build/dist/Graphics/SpriteSheet.js +115 -0
- package/build/dist/Graphics/SpriteSheet.js.map +1 -0
- package/build/dist/Graphics/Text.js +94 -0
- package/build/dist/Graphics/Text.js.map +1 -0
- package/build/dist/Graphics/index.js +42 -0
- package/build/dist/Graphics/index.js.map +1 -0
- package/build/dist/Id.js +8 -0
- package/build/dist/Id.js.map +1 -0
- package/build/dist/Input/CapturePointerConfig.js +5 -0
- package/build/dist/Input/CapturePointerConfig.js.map +1 -0
- package/build/dist/Input/EngineInput.js +2 -0
- package/build/dist/Input/EngineInput.js.map +1 -0
- package/build/dist/Input/Gamepad.js +358 -0
- package/build/dist/Input/Gamepad.js.map +1 -0
- package/build/dist/Input/Index.js +22 -0
- package/build/dist/Input/Index.js.map +1 -0
- package/build/dist/Input/Keyboard.js +267 -0
- package/build/dist/Input/Keyboard.js.map +1 -0
- package/build/dist/Input/NativePointerButton.js +12 -0
- package/build/dist/Input/NativePointerButton.js.map +1 -0
- package/build/dist/Input/PointerAbstraction.js +41 -0
- package/build/dist/Input/PointerAbstraction.js.map +1 -0
- package/build/dist/Input/PointerButton.js +12 -0
- package/build/dist/Input/PointerButton.js.map +1 -0
- package/build/dist/Input/PointerComponent.js +28 -0
- package/build/dist/Input/PointerComponent.js.map +1 -0
- package/build/dist/Input/PointerEvent.js +25 -0
- package/build/dist/Input/PointerEvent.js.map +1 -0
- package/build/dist/Input/PointerEventReceiver.js +414 -0
- package/build/dist/Input/PointerEventReceiver.js.map +1 -0
- package/build/dist/Input/PointerScope.js +16 -0
- package/build/dist/Input/PointerScope.js.map +1 -0
- package/build/dist/Input/PointerSystem.js +217 -0
- package/build/dist/Input/PointerSystem.js.map +1 -0
- package/build/dist/Input/PointerType.js +11 -0
- package/build/dist/Input/PointerType.js.map +1 -0
- package/build/dist/Input/WheelDeltaMode.js +7 -0
- package/build/dist/Input/WheelDeltaMode.js.map +1 -0
- package/build/dist/Input/WheelEvent.js +21 -0
- package/build/dist/Input/WheelEvent.js.map +1 -0
- package/build/dist/Interfaces/Audio.js +2 -0
- package/build/dist/Interfaces/Audio.js.map +1 -0
- package/build/dist/Interfaces/AudioImplementation.js +11 -0
- package/build/dist/Interfaces/AudioImplementation.js.map +1 -0
- package/build/dist/Interfaces/Clonable.js +2 -0
- package/build/dist/Interfaces/Clonable.js.map +1 -0
- package/build/dist/Interfaces/Drawable.js +2 -0
- package/build/dist/Interfaces/Drawable.js.map +1 -0
- package/build/dist/Interfaces/Evented.js +2 -0
- package/build/dist/Interfaces/Evented.js.map +1 -0
- package/build/dist/Interfaces/Index.js +10 -0
- package/build/dist/Interfaces/Index.js.map +1 -0
- package/build/dist/Interfaces/LifecycleEvents.js +51 -0
- package/build/dist/Interfaces/LifecycleEvents.js.map +1 -0
- package/build/dist/Interfaces/Loadable.js +2 -0
- package/build/dist/Interfaces/Loadable.js.map +1 -0
- package/build/dist/Interfaces/PointerEventHandlers.js +2 -0
- package/build/dist/Interfaces/PointerEventHandlers.js.map +1 -0
- package/build/dist/Interfaces/Trait.js +2 -0
- package/build/dist/Interfaces/Trait.js.map +1 -0
- package/build/dist/Label.js +273 -0
- package/build/dist/Label.js.map +1 -0
- package/build/dist/Loader.js +367 -0
- package/build/dist/Loader.js.map +1 -0
- package/build/dist/Math/Index.js +10 -0
- package/build/dist/Math/Index.js.map +1 -0
- package/build/dist/Math/Random.js +239 -0
- package/build/dist/Math/Random.js.map +1 -0
- package/build/dist/Math/global-coordinates.js +30 -0
- package/build/dist/Math/global-coordinates.js.map +1 -0
- package/build/dist/Math/line.js +194 -0
- package/build/dist/Math/line.js.map +1 -0
- package/build/dist/Math/matrix.js +446 -0
- package/build/dist/Math/matrix.js.map +1 -0
- package/build/dist/Math/projection.js +24 -0
- package/build/dist/Math/projection.js.map +1 -0
- package/build/dist/Math/ray.js +52 -0
- package/build/dist/Math/ray.js.map +1 -0
- package/build/dist/Math/util.js +82 -0
- package/build/dist/Math/util.js.map +1 -0
- package/build/dist/Math/vector-view.js +25 -0
- package/build/dist/Math/vector-view.js.map +1 -0
- package/build/dist/Math/vector.js +326 -0
- package/build/dist/Math/vector.js.map +1 -0
- package/build/dist/Particles.js +449 -0
- package/build/dist/Particles.js.map +1 -0
- package/build/dist/Polyfill.js +56 -0
- package/build/dist/Polyfill.js.map +1 -0
- package/build/dist/Promises.js +205 -0
- package/build/dist/Promises.js.map +1 -0
- package/build/dist/Resources/Gif.js +479 -0
- package/build/dist/Resources/Gif.js.map +1 -0
- package/build/dist/Resources/Index.js +4 -0
- package/build/dist/Resources/Index.js.map +1 -0
- package/build/dist/Resources/Resource.js +74 -0
- package/build/dist/Resources/Resource.js.map +1 -0
- package/build/dist/Resources/Sound/AudioContext.js +16 -0
- package/build/dist/Resources/Sound/AudioContext.js.map +1 -0
- package/build/dist/Resources/Sound/Index.js +4 -0
- package/build/dist/Resources/Sound/Index.js.map +1 -0
- package/build/dist/Resources/Sound/Sound.js +240 -0
- package/build/dist/Resources/Sound/Sound.js.map +1 -0
- package/build/dist/Resources/Sound/WebAudioInstance.js +160 -0
- package/build/dist/Resources/Sound/WebAudioInstance.js.map +1 -0
- package/build/dist/Scene.js +458 -0
- package/build/dist/Scene.js.map +1 -0
- package/build/dist/Screen.js +634 -0
- package/build/dist/Screen.js.map +1 -0
- package/build/dist/ScreenElement.js +29 -0
- package/build/dist/ScreenElement.js.map +1 -0
- package/build/dist/TileMap.js +488 -0
- package/build/dist/TileMap.js.map +1 -0
- package/build/dist/Timer.js +198 -0
- package/build/dist/Timer.js.map +1 -0
- package/build/dist/Traits/Index.js +5 -0
- package/build/dist/Traits/Index.js.map +1 -0
- package/build/dist/Traits/OffscreenCulling.js +35 -0
- package/build/dist/Traits/OffscreenCulling.js.map +1 -0
- package/build/dist/Trigger.js +113 -0
- package/build/dist/Trigger.js.map +1 -0
- package/build/dist/Util/Actors.js +19 -0
- package/build/dist/Util/Actors.js.map +1 -0
- package/build/dist/Util/Browser.js +66 -0
- package/build/dist/Util/Browser.js.map +1 -0
- package/build/dist/Util/Clock.js +219 -0
- package/build/dist/Util/Clock.js.map +1 -0
- package/build/dist/Util/CullingBox.js +104 -0
- package/build/dist/Util/CullingBox.js.map +1 -0
- package/build/dist/Util/Decorators.js +78 -0
- package/build/dist/Util/Decorators.js.map +1 -0
- package/build/dist/Util/Detector.js +167 -0
- package/build/dist/Util/Detector.js.map +1 -0
- package/build/dist/Util/DrawUtil.js +117 -0
- package/build/dist/Util/DrawUtil.js.map +1 -0
- package/build/dist/Util/EasingFunctions.js +118 -0
- package/build/dist/Util/EasingFunctions.js.map +1 -0
- package/build/dist/Util/Fps.js +47 -0
- package/build/dist/Util/Fps.js.map +1 -0
- package/build/dist/Util/Index.js +7 -0
- package/build/dist/Util/Index.js.map +1 -0
- package/build/dist/Util/Log.js +195 -0
- package/build/dist/Util/Log.js.map +1 -0
- package/build/dist/Util/Observable.js +60 -0
- package/build/dist/Util/Observable.js.map +1 -0
- package/build/dist/Util/Pool.js +66 -0
- package/build/dist/Util/Pool.js.map +1 -0
- package/build/dist/Util/SortedList.js +261 -0
- package/build/dist/Util/SortedList.js.map +1 -0
- package/build/dist/Util/Sound.js +22 -0
- package/build/dist/Util/Sound.js.map +1 -0
- package/build/dist/Util/Util.js +294 -0
- package/build/dist/Util/Util.js.map +1 -0
- package/build/dist/Util/Watch.js +67 -0
- package/build/dist/Util/Watch.js.map +1 -0
- package/build/dist/Util/WebAudio.js +62 -0
- package/build/dist/Util/WebAudio.js.map +1 -0
- package/build/dist/excalibur.js +101 -22
- package/build/dist/excalibur.js.map +1 -1
- package/build/dist/excalibur.min.js +1 -1
- package/build/dist/excalibur.min.js.LICENSE.txt +1 -1
- package/build/dist/excalibur.min.js.map +1 -1
- package/build/dist/index.js +74 -0
- package/build/dist/index.js.map +1 -0
- package/build/esm/Engine.d.ts +4 -1
- package/build/esm/Graphics/Context/texture-loader.d.ts +8 -0
- package/build/esm/excalibur.js +101 -22
- package/build/esm/excalibur.js.map +1 -1
- package/build/esm/excalibur.min.js +1 -1
- package/build/esm/excalibur.min.js.LICENSE.txt +1 -1
- package/build/esm/excalibur.min.js.map +1 -1
- package/package.json +23 -22
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { EventDispatcher } from './EventDispatcher';
|
|
2
|
+
/**
|
|
3
|
+
* Excalibur base class that provides basic functionality such as [[EventDispatcher]]
|
|
4
|
+
* and extending abilities for vanilla Javascript projects
|
|
5
|
+
*/
|
|
6
|
+
export class Class {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.eventDispatcher = new EventDispatcher();
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Alias for `addEventListener`. You can listen for a variety of
|
|
12
|
+
* events off of the engine; see the events section below for a complete list.
|
|
13
|
+
* @param eventName Name of the event to listen for
|
|
14
|
+
* @param handler Event handler for the thrown event
|
|
15
|
+
*/
|
|
16
|
+
on(eventName, handler) {
|
|
17
|
+
this.eventDispatcher.on(eventName, handler);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Alias for `removeEventListener`. If only the eventName is specified
|
|
21
|
+
* it will remove all handlers registered for that specific event. If the eventName
|
|
22
|
+
* and the handler instance are specified only that handler will be removed.
|
|
23
|
+
*
|
|
24
|
+
* @param eventName Name of the event to listen for
|
|
25
|
+
* @param handler Event handler for the thrown event
|
|
26
|
+
*/
|
|
27
|
+
off(eventName, handler) {
|
|
28
|
+
this.eventDispatcher.off(eventName, handler);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Emits a new event
|
|
32
|
+
* @param eventName Name of the event to emit
|
|
33
|
+
* @param eventObject Data associated with this event
|
|
34
|
+
*/
|
|
35
|
+
emit(eventName, eventObject) {
|
|
36
|
+
this.eventDispatcher.emit(eventName, eventObject);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Once listens to an event one time, then unsubscribes from that event
|
|
40
|
+
*
|
|
41
|
+
* @param eventName The name of the event to subscribe to once
|
|
42
|
+
* @param handler The handler of the event that will be auto unsubscribed
|
|
43
|
+
*/
|
|
44
|
+
once(eventName, handler) {
|
|
45
|
+
this.eventDispatcher.once(eventName, handler);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=Class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Class.js","sourceRoot":"","sources":["../../src/engine/Class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD;;;GAGG;AACH,MAAM,OAAO,KAAK;IAMhB;QACE,IAAI,CAAC,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;IAC/C,CAAC;IAED;;;;;OAKG;IACI,EAAE,CAAC,SAAiB,EAAE,OAA6B;QACxD,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;;;OAOG;IACI,GAAG,CAAC,SAAiB,EAAE,OAA8B;QAC1D,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED;;;;OAIG;IACI,IAAI,CAAC,SAAiB,EAAE,WAAgB;QAC7C,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IACpD,CAAC;IAED;;;;;OAKG;IACI,IAAI,CAAC,SAAiB,EAAE,OAA6B;QAC1D,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC;CACF"}
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import { Vector } from '../Math/vector';
|
|
2
|
+
import { CollisionType } from './CollisionType';
|
|
3
|
+
import { Physics } from './Physics';
|
|
4
|
+
import { TransformComponent } from '../EntityComponentSystem/Components/TransformComponent';
|
|
5
|
+
import { MotionComponent } from '../EntityComponentSystem/Components/MotionComponent';
|
|
6
|
+
import { Component } from '../EntityComponentSystem/Component';
|
|
7
|
+
import { CollisionGroup } from './Group/CollisionGroup';
|
|
8
|
+
import { EventDispatcher } from '../EventDispatcher';
|
|
9
|
+
import { createId } from '../Id';
|
|
10
|
+
import { clamp } from '../Math/util';
|
|
11
|
+
import { ColliderComponent } from './ColliderComponent';
|
|
12
|
+
export var DegreeOfFreedom;
|
|
13
|
+
(function (DegreeOfFreedom) {
|
|
14
|
+
DegreeOfFreedom["Rotation"] = "rotation";
|
|
15
|
+
DegreeOfFreedom["X"] = "x";
|
|
16
|
+
DegreeOfFreedom["Y"] = "y";
|
|
17
|
+
})(DegreeOfFreedom || (DegreeOfFreedom = {}));
|
|
18
|
+
/**
|
|
19
|
+
* Body describes all the physical properties pos, vel, acc, rotation, angular velocity for the purpose of
|
|
20
|
+
* of physics simulation.
|
|
21
|
+
*/
|
|
22
|
+
export class BodyComponent extends Component {
|
|
23
|
+
constructor(options) {
|
|
24
|
+
var _a, _b, _c;
|
|
25
|
+
super();
|
|
26
|
+
this.type = 'ex.body';
|
|
27
|
+
this.dependencies = [TransformComponent, MotionComponent];
|
|
28
|
+
this.id = createId('body', BodyComponent._ID++);
|
|
29
|
+
this.events = new EventDispatcher();
|
|
30
|
+
/**
|
|
31
|
+
* Collision type for the rigidbody physics simulation, by default [[CollisionType.PreventCollision]]
|
|
32
|
+
*/
|
|
33
|
+
this.collisionType = CollisionType.PreventCollision;
|
|
34
|
+
/**
|
|
35
|
+
* The collision group for the body's colliders, by default body colliders collide with everything
|
|
36
|
+
*/
|
|
37
|
+
this.group = CollisionGroup.All;
|
|
38
|
+
/**
|
|
39
|
+
* The amount of mass the body has
|
|
40
|
+
*/
|
|
41
|
+
this.mass = Physics.defaultMass;
|
|
42
|
+
/**
|
|
43
|
+
* Amount of "motion" the body has before sleeping. If below [[Physics.sleepEpsilon]] it goes to "sleep"
|
|
44
|
+
*/
|
|
45
|
+
this.sleepMotion = Physics.sleepEpsilon * 5;
|
|
46
|
+
/**
|
|
47
|
+
* Can this body sleep, by default bodies do not sleep
|
|
48
|
+
*/
|
|
49
|
+
this.canSleep = Physics.bodiesCanSleepByDefault;
|
|
50
|
+
this._sleeping = false;
|
|
51
|
+
/**
|
|
52
|
+
* The also known as coefficient of restitution of this actor, represents the amount of energy preserved after collision or the
|
|
53
|
+
* bounciness. If 1, it is 100% bouncy, 0 it completely absorbs.
|
|
54
|
+
*/
|
|
55
|
+
this.bounciness = 0.2;
|
|
56
|
+
/**
|
|
57
|
+
* The coefficient of friction on this actor
|
|
58
|
+
*/
|
|
59
|
+
this.friction = 0.99;
|
|
60
|
+
/**
|
|
61
|
+
* Should use global gravity [[Physics.gravity]] in it's physics simulation, default is true
|
|
62
|
+
*/
|
|
63
|
+
this.useGravity = true;
|
|
64
|
+
/**
|
|
65
|
+
* Degrees of freedom to limit
|
|
66
|
+
*/
|
|
67
|
+
this.limitDegreeOfFreedom = [];
|
|
68
|
+
/**
|
|
69
|
+
* The position of the actor last frame (x, y) in pixels
|
|
70
|
+
*/
|
|
71
|
+
this.oldPos = new Vector(0, 0);
|
|
72
|
+
/**
|
|
73
|
+
* The velocity of the actor last frame (vx, vy) in pixels/second
|
|
74
|
+
*/
|
|
75
|
+
this.oldVel = new Vector(0, 0);
|
|
76
|
+
/**
|
|
77
|
+
* Gets/sets the acceleration of the actor from the last frame. This does not include the global acc [[Physics.acc]].
|
|
78
|
+
*/
|
|
79
|
+
this.oldAcc = Vector.Zero;
|
|
80
|
+
/**
|
|
81
|
+
* Gets/sets the rotation of the body from the last frame.
|
|
82
|
+
*/
|
|
83
|
+
this.oldRotation = 0; // radians
|
|
84
|
+
/**
|
|
85
|
+
* The scale of the actor last frame
|
|
86
|
+
* @deprecated ex.Body.scale will be removed in v0.25.0
|
|
87
|
+
*/
|
|
88
|
+
this.oldScale = Vector.One;
|
|
89
|
+
if (options) {
|
|
90
|
+
this.collisionType = (_a = options.type) !== null && _a !== void 0 ? _a : this.collisionType;
|
|
91
|
+
this.group = (_b = options.group) !== null && _b !== void 0 ? _b : this.group;
|
|
92
|
+
this.useGravity = (_c = options.useGravity) !== null && _c !== void 0 ? _c : this.useGravity;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* The inverse mass (1/mass) of the body. If [[CollisionType.Fixed]] this is 0, meaning "infinite" mass
|
|
97
|
+
*/
|
|
98
|
+
get inverseMass() {
|
|
99
|
+
return this.collisionType === CollisionType.Fixed ? 0 : 1 / this.mass;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Whether this body is sleeping or not
|
|
103
|
+
*/
|
|
104
|
+
get sleeping() {
|
|
105
|
+
return this._sleeping;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Set the sleep state of the body
|
|
109
|
+
* @param sleeping
|
|
110
|
+
*/
|
|
111
|
+
setSleeping(sleeping) {
|
|
112
|
+
this._sleeping = sleeping;
|
|
113
|
+
if (!sleeping) {
|
|
114
|
+
// Give it a kick to keep it from falling asleep immediately
|
|
115
|
+
this.sleepMotion = Physics.sleepEpsilon * 5;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
this.vel = Vector.Zero;
|
|
119
|
+
this.acc = Vector.Zero;
|
|
120
|
+
this.angularVelocity = 0;
|
|
121
|
+
this.sleepMotion = 0;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Update body's [[BodyComponent.sleepMotion]] for the purpose of sleeping
|
|
126
|
+
*/
|
|
127
|
+
updateMotion() {
|
|
128
|
+
if (this._sleeping) {
|
|
129
|
+
this.setSleeping(true);
|
|
130
|
+
}
|
|
131
|
+
const currentMotion = this.vel.size * this.vel.size + Math.abs(this.angularVelocity * this.angularVelocity);
|
|
132
|
+
const bias = Physics.sleepBias;
|
|
133
|
+
this.sleepMotion = bias * this.sleepMotion + (1 - bias) * currentMotion;
|
|
134
|
+
this.sleepMotion = clamp(this.sleepMotion, 0, 10 * Physics.sleepEpsilon);
|
|
135
|
+
if (this.canSleep && this.sleepMotion < Physics.sleepEpsilon) {
|
|
136
|
+
this.setSleeping(true);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Get the moment of inertia from the [[ColliderComponent]]
|
|
141
|
+
*/
|
|
142
|
+
get inertia() {
|
|
143
|
+
// Inertia is a property of the geometry, so this is a little goofy but seems to be okay?
|
|
144
|
+
const collider = this.owner.get(ColliderComponent);
|
|
145
|
+
if (collider === null || collider === void 0 ? void 0 : collider.get()) {
|
|
146
|
+
return collider.get().getInertia(this.mass);
|
|
147
|
+
}
|
|
148
|
+
return 0;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Get the inverse moment of inertial from the [[ColliderComponent]]. If [[CollisionType.Fixed]] this is 0, meaning "infinite" mass
|
|
152
|
+
*/
|
|
153
|
+
get inverseInertia() {
|
|
154
|
+
return this.collisionType === CollisionType.Fixed ? 0 : 1 / this.inertia;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Returns if the owner is active
|
|
158
|
+
*/
|
|
159
|
+
get active() {
|
|
160
|
+
var _a;
|
|
161
|
+
return !!((_a = this.owner) === null || _a === void 0 ? void 0 : _a.active);
|
|
162
|
+
}
|
|
163
|
+
get center() {
|
|
164
|
+
return this.pos;
|
|
165
|
+
}
|
|
166
|
+
get transform() {
|
|
167
|
+
var _a;
|
|
168
|
+
return (_a = this.owner) === null || _a === void 0 ? void 0 : _a.get(TransformComponent);
|
|
169
|
+
}
|
|
170
|
+
get motion() {
|
|
171
|
+
var _a;
|
|
172
|
+
return (_a = this.owner) === null || _a === void 0 ? void 0 : _a.get(MotionComponent);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* The (x, y) position of the actor this will be in the middle of the actor if the
|
|
176
|
+
* [[Actor.anchor]] is set to (0.5, 0.5) which is default.
|
|
177
|
+
* If you want the (x, y) position to be the top left of the actor specify an anchor of (0, 0).
|
|
178
|
+
*/
|
|
179
|
+
get pos() {
|
|
180
|
+
return this.transform.globalPos;
|
|
181
|
+
}
|
|
182
|
+
set pos(val) {
|
|
183
|
+
this.transform.globalPos = val;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* The current velocity vector (vx, vy) of the actor in pixels/second
|
|
187
|
+
*/
|
|
188
|
+
get vel() {
|
|
189
|
+
return this.motion.vel;
|
|
190
|
+
}
|
|
191
|
+
set vel(val) {
|
|
192
|
+
this.motion.vel = val;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* The current acceleration vector (ax, ay) of the actor in pixels/second/second. An acceleration pointing down such as (0, 100) may
|
|
196
|
+
* be useful to simulate a gravitational effect.
|
|
197
|
+
*/
|
|
198
|
+
get acc() {
|
|
199
|
+
return this.motion.acc;
|
|
200
|
+
}
|
|
201
|
+
set acc(val) {
|
|
202
|
+
this.motion.acc = val;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* The current torque applied to the actor
|
|
206
|
+
*/
|
|
207
|
+
get torque() {
|
|
208
|
+
return this.motion.torque;
|
|
209
|
+
}
|
|
210
|
+
set torque(val) {
|
|
211
|
+
this.motion.torque = val;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* The rotation of the body in radians
|
|
215
|
+
*/
|
|
216
|
+
get rotation() {
|
|
217
|
+
return this.transform.globalRotation;
|
|
218
|
+
}
|
|
219
|
+
set rotation(val) {
|
|
220
|
+
this.transform.globalRotation = val;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* The scale vector of the actor
|
|
224
|
+
* @deprecated ex.Body.scale will be removed in v0.25.0, Use ex.Transform.scale
|
|
225
|
+
*/
|
|
226
|
+
get scale() {
|
|
227
|
+
return this.transform.globalScale;
|
|
228
|
+
}
|
|
229
|
+
set scale(val) {
|
|
230
|
+
this.transform.globalScale = val;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* The x scalar velocity of the actor in scale/second
|
|
234
|
+
* @deprecated ex.Body.scale will be removed in v0.25.0
|
|
235
|
+
*/
|
|
236
|
+
get sx() {
|
|
237
|
+
return this.motion.scaleFactor.x;
|
|
238
|
+
}
|
|
239
|
+
set sx(xFactor) {
|
|
240
|
+
this.motion.scaleFactor.x = xFactor;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* The y scalar velocity of the actor in scale/second
|
|
244
|
+
* @deprecated ex.Body.scale will be removed in v0.25.0
|
|
245
|
+
*/
|
|
246
|
+
get sy() {
|
|
247
|
+
return this.motion.scaleFactor.y;
|
|
248
|
+
}
|
|
249
|
+
set sy(yFactor) {
|
|
250
|
+
this.motion.scaleFactor.y = yFactor;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* The rotational velocity of the actor in radians/second
|
|
254
|
+
* @deprecated
|
|
255
|
+
*/
|
|
256
|
+
get rx() {
|
|
257
|
+
return this.motion.angularVelocity;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* The rotational velocity of the actor in radians/second
|
|
261
|
+
* @deprecated
|
|
262
|
+
*/
|
|
263
|
+
set rx(value) {
|
|
264
|
+
this.motion.angularVelocity = value;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Get the angular velocity in radians/second
|
|
268
|
+
*/
|
|
269
|
+
get angularVelocity() {
|
|
270
|
+
return this.motion.angularVelocity;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Set the angular velocity in radians/second
|
|
274
|
+
*/
|
|
275
|
+
set angularVelocity(value) {
|
|
276
|
+
this.motion.angularVelocity = value;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Apply a specific impulse to the body
|
|
280
|
+
* @param point
|
|
281
|
+
* @param impulse
|
|
282
|
+
*/
|
|
283
|
+
applyImpulse(point, impulse) {
|
|
284
|
+
if (this.collisionType !== CollisionType.Active) {
|
|
285
|
+
return; // only active objects participate in the simulation
|
|
286
|
+
}
|
|
287
|
+
const finalImpulse = impulse.scale(this.inverseMass);
|
|
288
|
+
if (this.limitDegreeOfFreedom.includes(DegreeOfFreedom.X)) {
|
|
289
|
+
finalImpulse.x = 0;
|
|
290
|
+
}
|
|
291
|
+
if (this.limitDegreeOfFreedom.includes(DegreeOfFreedom.Y)) {
|
|
292
|
+
finalImpulse.y = 0;
|
|
293
|
+
}
|
|
294
|
+
this.vel.addEqual(finalImpulse);
|
|
295
|
+
if (!this.limitDegreeOfFreedom.includes(DegreeOfFreedom.Rotation)) {
|
|
296
|
+
const distanceFromCenter = point.sub(this.pos);
|
|
297
|
+
this.angularVelocity += this.inverseInertia * distanceFromCenter.cross(impulse);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Apply only linear impulse to the body
|
|
302
|
+
* @param impulse
|
|
303
|
+
*/
|
|
304
|
+
applyLinearImpulse(impulse) {
|
|
305
|
+
if (this.collisionType !== CollisionType.Active) {
|
|
306
|
+
return; // only active objects participate in the simulation
|
|
307
|
+
}
|
|
308
|
+
const finalImpulse = impulse.scale(this.inverseMass);
|
|
309
|
+
if (this.limitDegreeOfFreedom.includes(DegreeOfFreedom.X)) {
|
|
310
|
+
finalImpulse.x = 0;
|
|
311
|
+
}
|
|
312
|
+
if (this.limitDegreeOfFreedom.includes(DegreeOfFreedom.Y)) {
|
|
313
|
+
finalImpulse.y = 0;
|
|
314
|
+
}
|
|
315
|
+
this.vel = this.vel.add(finalImpulse);
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Apply only angular impulse to the body
|
|
319
|
+
* @param point
|
|
320
|
+
* @param impulse
|
|
321
|
+
*/
|
|
322
|
+
applyAngularImpulse(point, impulse) {
|
|
323
|
+
if (this.collisionType !== CollisionType.Active) {
|
|
324
|
+
return; // only active objects participate in the simulation
|
|
325
|
+
}
|
|
326
|
+
if (!this.limitDegreeOfFreedom.includes(DegreeOfFreedom.Rotation)) {
|
|
327
|
+
const distanceFromCenter = point.sub(this.pos);
|
|
328
|
+
this.angularVelocity += this.inverseInertia * distanceFromCenter.cross(impulse);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Sets the old versions of pos, vel, acc, and scale.
|
|
333
|
+
*/
|
|
334
|
+
captureOldTransform() {
|
|
335
|
+
// Capture old values before integration step updates them
|
|
336
|
+
this.oldVel.setTo(this.vel.x, this.vel.y);
|
|
337
|
+
this.oldPos.setTo(this.pos.x, this.pos.y);
|
|
338
|
+
this.oldAcc.setTo(this.acc.x, this.acc.y);
|
|
339
|
+
this.oldScale.setTo(this.scale.x, this.scale.y);
|
|
340
|
+
this.oldRotation = this.rotation;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* @deprecated signature will change in v0.26.0
|
|
344
|
+
* @param _ctx
|
|
345
|
+
*/
|
|
346
|
+
debugDraw(_ctx) {
|
|
347
|
+
// pass
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
BodyComponent._ID = 0;
|
|
351
|
+
//# sourceMappingURL=BodyComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BodyComponent.js","sourceRoot":"","sources":["../../../src/engine/Collision/BodyComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wDAAwD,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAM,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAQxD,MAAM,CAAN,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,wCAAqB,CAAA;IACrB,0BAAO,CAAA;IACP,0BAAO,CAAA;AACT,CAAC,EAJW,eAA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