emeraldengine 2.2.1 → 3.1.0
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/README.md +2198 -968
- package/dist/types/index.d.ts +75 -32
- package/dist/types/src/Animator.d.ts +50 -0
- package/dist/types/{BitmapText.d.ts → src/BitmapText.d.ts} +19 -21
- package/dist/types/src/Camera.d.ts +122 -0
- package/dist/types/src/CameraController.d.ts +107 -0
- package/dist/types/src/CanvasText.d.ts +91 -0
- package/dist/types/src/CollisionLayers.d.ts +58 -0
- package/dist/types/{Color.d.ts → src/Color.d.ts} +6 -6
- package/dist/types/src/Coroutine.d.ts +111 -0
- package/dist/types/src/DebugOverlay.d.ts +86 -0
- package/dist/types/src/Drawable.d.ts +271 -0
- package/dist/types/src/Easing.d.ts +22 -0
- package/dist/types/src/Emerald.d.ts +420 -0
- package/dist/types/src/EmeraldDB.d.ts +159 -0
- package/dist/types/{FPSCounter.d.ts → src/FPSCounter.d.ts} +1 -3
- package/dist/types/src/GLUtils.d.ts +4 -0
- package/dist/types/{Instance.d.ts → src/Instance.d.ts} +37 -15
- package/dist/types/{InstancedTexture.d.ts → src/InstancedTexture.d.ts} +75 -23
- package/dist/types/src/Interpolator.d.ts +66 -0
- package/dist/types/src/Material.d.ts +87 -0
- package/dist/types/src/MathUtils.d.ts +81 -0
- package/dist/types/src/ParticleEmitter.d.ts +131 -0
- package/dist/types/src/Physics.d.ts +337 -0
- package/dist/types/src/Pool.d.ts +53 -0
- package/dist/types/src/PostEffects.d.ts +68 -0
- package/dist/types/src/PostProcessor.d.ts +124 -0
- package/dist/types/src/RenderTarget.d.ts +56 -0
- package/dist/types/src/Scene.d.ts +62 -0
- package/dist/types/src/ScreenEffects.d.ts +111 -0
- package/dist/types/src/Serializer.d.ts +86 -0
- package/dist/types/src/Shaders.d.ts +2 -0
- package/dist/types/{Shapes.d.ts → src/Shapes.d.ts} +4 -6
- package/dist/types/src/SpatialGrid.d.ts +50 -0
- package/dist/types/src/SpriteBatch.d.ts +89 -0
- package/dist/types/src/StateMachine.d.ts +59 -0
- package/dist/types/src/Storage.d.ts +89 -0
- package/dist/types/{Texture.d.ts → src/Texture.d.ts} +3 -4
- package/dist/types/src/TextureAtlas.d.ts +55 -0
- package/dist/types/src/Tilemap.d.ts +91 -0
- package/dist/types/src/Time.d.ts +53 -0
- package/dist/types/src/Timer.d.ts +54 -0
- package/dist/types/src/Transform.d.ts +94 -0
- package/dist/types/src/Tween.d.ts +81 -0
- package/dist/types/src/UI.d.ts +121 -0
- package/dist/types/src/components/Behaviour.d.ts +71 -0
- package/dist/types/{components → src/components}/BoxCollider.d.ts +14 -14
- package/dist/types/src/components/BoxColliderDebug.d.ts +15 -0
- package/dist/types/{components → src/components}/CircleCollider.d.ts +14 -12
- package/dist/types/src/components/CircleColliderDebug.d.ts +15 -0
- package/dist/types/src/components/Collider.d.ts +102 -0
- package/dist/types/src/components/GameObject.d.ts +135 -0
- package/dist/types/src/components/PolygonCollider.d.ts +33 -0
- package/dist/types/src/components/RigidBody.d.ts +456 -0
- package/dist/types/src/importers/Aseprite.d.ts +79 -0
- package/dist/types/src/importers/ForgeLevel.d.ts +97 -0
- package/dist/types/src/importers/TiledMap.d.ts +62 -0
- package/dist/types/{lights → src/lights}/DirectionalLight.d.ts +7 -9
- package/dist/types/{lights → src/lights}/PointLight.d.ts +6 -9
- package/dist/types/src/managers/AssetManager.d.ts +116 -0
- package/dist/types/src/managers/AudioManager.d.ts +259 -0
- package/dist/types/{managers → src/managers}/CameraManager.d.ts +8 -8
- package/dist/types/{managers → src/managers}/EventManager.d.ts +46 -32
- package/dist/types/src/managers/GLManager.d.ts +84 -0
- package/dist/types/src/managers/GLState.d.ts +37 -0
- package/dist/types/src/managers/Gamepad.d.ts +102 -0
- package/dist/types/src/managers/IDManager.d.ts +31 -0
- package/dist/types/src/managers/InputManager.d.ts +381 -0
- package/dist/types/src/managers/NetworkManager.d.ts +93 -0
- package/dist/types/src/managers/RenderStats.d.ts +34 -0
- package/dist/types/src/managers/SceneManager.d.ts +44 -0
- package/dist/types/src/managers/ShaderManager.d.ts +55 -0
- package/dist/types/src/managers/TextureManager.d.ts +102 -0
- package/dist/types/src/particlesystem/Particle.d.ts +64 -0
- package/dist/types/{particlesystem → src/particlesystem}/ParticleSettings.d.ts +32 -24
- package/dist/types/{particlesystem → src/particlesystem}/Particles.d.ts +20 -12
- package/dist/types/src/physics/AABB.d.ts +92 -0
- package/dist/types/src/physics/Body.d.ts +435 -0
- package/dist/types/src/physics/BodyType.d.ts +6 -0
- package/dist/types/src/physics/BroadPhase.d.ts +210 -0
- package/dist/types/src/physics/Collision.d.ts +102 -0
- package/dist/types/src/physics/Contact.d.ts +206 -0
- package/dist/types/src/physics/ContactSolver.d.ts +108 -0
- package/dist/types/src/physics/Distance.d.ts +54 -0
- package/dist/types/src/physics/DistanceJoint.d.ts +90 -0
- package/dist/types/src/physics/Fixture.d.ts +221 -0
- package/dist/types/src/physics/Island.d.ts +52 -0
- package/dist/types/src/physics/Joint.d.ts +59 -0
- package/dist/types/src/physics/Math2D.d.ts +371 -0
- package/dist/types/src/physics/RevoluteJoint.d.ts +119 -0
- package/dist/types/src/physics/Settings.d.ts +22 -0
- package/dist/types/src/physics/Shapes.d.ts +207 -0
- package/dist/types/src/physics/TimeOfImpact.d.ts +22 -0
- package/dist/types/src/physics/World.d.ts +274 -0
- package/dist/types/src/physics/index.d.ts +34 -0
- package/index.js +78 -0
- package/package.json +73 -60
- package/src/Animator.js +95 -0
- package/src/BitmapText.js +6 -5
- package/src/Camera.js +183 -0
- package/src/CameraController.js +192 -0
- package/src/CanvasText.js +281 -0
- package/src/CollisionLayers.js +86 -0
- package/src/Color.js +26 -18
- package/src/Coroutine.js +259 -0
- package/src/DebugOverlay.js +246 -0
- package/src/Drawable.js +842 -582
- package/src/Easing.js +57 -0
- package/src/Emerald.js +1150 -459
- package/src/EmeraldDB.js +328 -0
- package/src/FPSCounter.js +43 -43
- package/src/GLUtils.js +60 -67
- package/src/Instance.js +41 -5
- package/src/InstancedTexture.js +308 -127
- package/src/Interpolator.js +124 -0
- package/src/Material.js +202 -0
- package/src/MathUtils.js +134 -0
- package/src/ParticleEmitter.js +284 -0
- package/src/Physics.js +431 -40
- package/src/Pool.js +85 -0
- package/src/PostEffects.js +296 -0
- package/src/PostProcessor.js +304 -0
- package/src/RenderTarget.js +134 -0
- package/src/Scene.js +115 -83
- package/src/ScreenEffects.js +266 -0
- package/src/Serializer.js +131 -0
- package/src/Shaders.js +150 -165
- package/src/Shapes.js +118 -129
- package/src/SpatialGrid.js +111 -0
- package/src/SpriteBatch.js +299 -0
- package/src/StateMachine.js +82 -0
- package/src/Storage.js +175 -47
- package/src/Texture.js +58 -67
- package/src/TextureAtlas.js +96 -0
- package/src/Tilemap.js +274 -0
- package/src/Time.js +51 -6
- package/src/Timer.js +99 -0
- package/src/Transform.js +100 -7
- package/src/Tween.js +160 -0
- package/src/UI.js +394 -0
- package/src/components/Behaviour.js +90 -0
- package/src/components/BoxCollider.js +29 -12
- package/src/components/BoxColliderDebug.js +3 -4
- package/src/components/CircleCollider.js +26 -12
- package/src/components/CircleColliderDebug.js +25 -24
- package/src/components/Collider.js +150 -34
- package/src/components/GameObject.js +130 -21
- package/src/components/PolygonCollider.js +55 -0
- package/src/components/RigidBody.js +556 -8
- package/src/importers/Aseprite.js +142 -0
- package/src/importers/ForgeLevel.js +581 -0
- package/src/importers/TiledMap.js +158 -0
- package/src/lights/DirectionalLight.js +6 -15
- package/src/lights/PointLight.js +4 -4
- package/src/managers/AssetManager.js +239 -0
- package/src/managers/AudioManager.js +565 -146
- package/src/managers/EventManager.js +488 -477
- package/src/managers/GLManager.js +57 -0
- package/src/managers/GLState.js +70 -0
- package/src/managers/Gamepad.js +126 -0
- package/src/managers/IDManager.js +24 -2
- package/src/managers/InputManager.js +905 -0
- package/src/managers/NetworkManager.js +178 -0
- package/src/managers/RenderStats.js +34 -0
- package/src/managers/SceneManager.js +30 -0
- package/src/managers/ShaderManager.js +0 -2
- package/src/managers/TextureManager.js +218 -0
- package/src/particlesystem/Particle.js +82 -7
- package/src/particlesystem/ParticleSettings.js +21 -3
- package/src/particlesystem/Particles.js +80 -31
- package/src/physics/AABB.js +207 -0
- package/src/physics/Body.js +862 -0
- package/src/physics/BodyType.js +16 -0
- package/src/physics/BroadPhase.js +641 -0
- package/src/physics/Collision.js +534 -0
- package/src/physics/Contact.js +500 -0
- package/src/physics/ContactSolver.js +526 -0
- package/src/physics/Distance.js +403 -0
- package/src/physics/DistanceJoint.js +227 -0
- package/src/physics/Fixture.js +346 -0
- package/src/physics/Island.js +203 -0
- package/src/physics/Joint.js +78 -0
- package/src/physics/Math2D.js +573 -0
- package/src/physics/RevoluteJoint.js +278 -0
- package/src/physics/Settings.js +78 -0
- package/src/physics/Shapes.js +549 -0
- package/src/physics/TimeOfImpact.js +87 -0
- package/src/physics/World.js +731 -0
- package/src/physics/index.js +79 -0
- package/dist/types/Drawable.d.ts +0 -157
- package/dist/types/Emerald.d.ts +0 -73
- package/dist/types/GLUtils.d.ts +0 -6
- package/dist/types/Physics.d.ts +0 -139
- package/dist/types/Scene.d.ts +0 -39
- package/dist/types/Shaders.d.ts +0 -4
- package/dist/types/Storage.d.ts +0 -46
- package/dist/types/Time.d.ts +0 -22
- package/dist/types/Transform.d.ts +0 -41
- package/dist/types/components/BoxColliderDebug.d.ts +0 -19
- package/dist/types/components/CircleColliderDebug.d.ts +0 -19
- package/dist/types/components/Collider.d.ts +0 -53
- package/dist/types/components/GameObject.d.ts +0 -72
- package/dist/types/components/RigidBody.d.ts +0 -104
- package/dist/types/managers/AudioManager.d.ts +0 -60
- package/dist/types/managers/GLManager.d.ts +0 -47
- package/dist/types/managers/IDManager.d.ts +0 -21
- package/dist/types/managers/SceneManager.d.ts +0 -22
- package/dist/types/particlesystem/Particle.d.ts +0 -42
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
export default Collider;
|
|
2
|
+
/**
|
|
3
|
+
* @class Collider
|
|
4
|
+
* @param {Rigidbody} rigidbody - The rigidbody to attach the collider to
|
|
5
|
+
* @param {boolean} isSensor - Whether the collider is a sensor
|
|
6
|
+
* @param {GameObject} parentObject - The parent object of the collider
|
|
7
|
+
*/
|
|
8
|
+
declare class Collider {
|
|
9
|
+
constructor(rigidbody: any, isSensor?: boolean, parentObject?: any);
|
|
10
|
+
rigidbody: any;
|
|
11
|
+
parentObject: any;
|
|
12
|
+
isSensor: boolean;
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
/** @private */
|
|
16
|
+
private _debugShape;
|
|
17
|
+
/**
|
|
18
|
+
* @method syncDebugShape
|
|
19
|
+
* @description Mirrors a transform onto the debug shape, but only if one has
|
|
20
|
+
* already been created. Never forces lazy creation.
|
|
21
|
+
*
|
|
22
|
+
* The rigidbody's spawn offset is added back, because the collider sits at
|
|
23
|
+
* `transform + offset` while the transform tracks the renderable. Without it
|
|
24
|
+
* the debug shape would drift away from the collider it is supposed to be
|
|
25
|
+
* showing on any body built with an offset.
|
|
26
|
+
*
|
|
27
|
+
* @param {Transform} transform - The source transform
|
|
28
|
+
*/
|
|
29
|
+
syncDebugShape(transform: Transform): void;
|
|
30
|
+
/**
|
|
31
|
+
* @method setFilter
|
|
32
|
+
* @description Sets the raw collision filter on this collider's
|
|
33
|
+
* fixture. Two fixtures collide only when each one's category bit is present
|
|
34
|
+
* in the other's mask. Subclasses must have created `this.collider`
|
|
35
|
+
* (the fixture) first.
|
|
36
|
+
* @param {Object} filter - { category, mask, group }
|
|
37
|
+
* @param {number} [filter.category=0x0001] - This fixture's category bits
|
|
38
|
+
* @param {number} [filter.mask=0xFFFF] - Bits this fixture collides with
|
|
39
|
+
* @param {number} [filter.group=0] - Group index (>0 always collide, <0 never)
|
|
40
|
+
* @returns {Collider} - this
|
|
41
|
+
*/
|
|
42
|
+
setFilter({ category, mask, group }?: {
|
|
43
|
+
category?: number;
|
|
44
|
+
mask?: number;
|
|
45
|
+
group?: number;
|
|
46
|
+
}): Collider;
|
|
47
|
+
/** @private */
|
|
48
|
+
private _filter;
|
|
49
|
+
/**
|
|
50
|
+
* @method setCategory
|
|
51
|
+
* @description Sets which named layer this collider belongs to (its category
|
|
52
|
+
* bits), preserving the current mask/group. See {@link CollisionLayers}.
|
|
53
|
+
* @param {string|number} layer - Layer name or raw category bits
|
|
54
|
+
* @returns {Collider} - this
|
|
55
|
+
*/
|
|
56
|
+
setCategory(layer: string | number): Collider;
|
|
57
|
+
/**
|
|
58
|
+
* @method setCollidesWith
|
|
59
|
+
* @description Sets which layers this collider can collide with (its mask),
|
|
60
|
+
* preserving the current category/group.
|
|
61
|
+
* @param {string|string[]|number} layers - Layer name(s) or raw mask bits
|
|
62
|
+
* @returns {Collider} - this
|
|
63
|
+
*/
|
|
64
|
+
setCollidesWith(layers: string | string[] | number): Collider;
|
|
65
|
+
/**
|
|
66
|
+
* @method getFilter
|
|
67
|
+
* @description Returns the last applied filter, or null if none was set.
|
|
68
|
+
* @returns {{category:number, mask:number, group:number}|null}
|
|
69
|
+
*/
|
|
70
|
+
getFilter(): {
|
|
71
|
+
category: number;
|
|
72
|
+
mask: number;
|
|
73
|
+
group: number;
|
|
74
|
+
} | null;
|
|
75
|
+
/**
|
|
76
|
+
* @method _applyFilterSpec
|
|
77
|
+
* @description Applies a friendly filter spec from a constructor, accepting
|
|
78
|
+
* layer names or raw bits. Spec: { category, collidesWith, group }.
|
|
79
|
+
* @private
|
|
80
|
+
*/
|
|
81
|
+
private _applyFilterSpec;
|
|
82
|
+
/**
|
|
83
|
+
* @method getRigidBody
|
|
84
|
+
* @description Returns the rigidbody of the collider
|
|
85
|
+
*/
|
|
86
|
+
getRigidBody(): any;
|
|
87
|
+
/**
|
|
88
|
+
* @method getCollider
|
|
89
|
+
* @description Returns the collider
|
|
90
|
+
*/
|
|
91
|
+
getCollider(): any;
|
|
92
|
+
/**
|
|
93
|
+
* @method setParent
|
|
94
|
+
* @description Sets the parent object of the collider
|
|
95
|
+
*/
|
|
96
|
+
setParent(parent: any): void;
|
|
97
|
+
/**
|
|
98
|
+
* @method getParent
|
|
99
|
+
* @description Returns the parent object of the collider
|
|
100
|
+
*/
|
|
101
|
+
getParent(): any;
|
|
102
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
export default GameObject;
|
|
2
|
+
/**
|
|
3
|
+
* @class GameObject
|
|
4
|
+
* @param {string} name - The name of the game object
|
|
5
|
+
* @param {Vector3} position - The position of the game object
|
|
6
|
+
* @param {number} rotation - The rotation of the game object
|
|
7
|
+
* @param {Vector2} scale - The scale of the game object
|
|
8
|
+
*/
|
|
9
|
+
declare class GameObject {
|
|
10
|
+
constructor(name: any, position?: Vector3, rotation?: number, scale?: Vector2);
|
|
11
|
+
name: any;
|
|
12
|
+
components: any[];
|
|
13
|
+
id: string;
|
|
14
|
+
isActive: boolean;
|
|
15
|
+
transform: Transform;
|
|
16
|
+
opacity: number;
|
|
17
|
+
layer: number;
|
|
18
|
+
screenSpace: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* @method setLayer
|
|
21
|
+
* @description Sets the render layer. Objects are drawn by layer first, then
|
|
22
|
+
* by z within a layer.
|
|
23
|
+
* @param {number} layer - The layer index
|
|
24
|
+
* @returns {GameObject} - this
|
|
25
|
+
*/
|
|
26
|
+
setLayer(layer: number): GameObject;
|
|
27
|
+
/**
|
|
28
|
+
* @method setScreenSpace
|
|
29
|
+
* @description When true, the object ignores the camera (fixed on screen),
|
|
30
|
+
* useful for HUD/UI. Position is then in pixels from the viewport center.
|
|
31
|
+
* Note: not supported for InstancedTexture-based objects.
|
|
32
|
+
* @param {boolean} value
|
|
33
|
+
* @returns {GameObject} - this
|
|
34
|
+
*/
|
|
35
|
+
setScreenSpace(value: boolean): GameObject;
|
|
36
|
+
/**
|
|
37
|
+
* @method addComponent
|
|
38
|
+
* @description Adds a component to the game object
|
|
39
|
+
* @param {Component} componentInstance - The component to add
|
|
40
|
+
*/
|
|
41
|
+
addComponent(componentInstance: Component): void;
|
|
42
|
+
/**
|
|
43
|
+
* @method removeComponent
|
|
44
|
+
* @description Removes a component from the game object
|
|
45
|
+
* @param {Component} component - The component to remove
|
|
46
|
+
*/
|
|
47
|
+
removeComponent(component: Component): void;
|
|
48
|
+
/**
|
|
49
|
+
* @method update
|
|
50
|
+
* @description Ticks the lifecycle of Behaviour components on this object.
|
|
51
|
+
* Only Behaviours are ticked here so component types with their own update
|
|
52
|
+
* signature (e.g. InstancedTexture) are left untouched.
|
|
53
|
+
* @param {number} deltaTime - Seconds since the previous frame (time-scaled)
|
|
54
|
+
*/
|
|
55
|
+
update(deltaTime: number): void;
|
|
56
|
+
/**
|
|
57
|
+
* @method setParent
|
|
58
|
+
* @description Parents this object to another GameObject (or detaches with
|
|
59
|
+
* null). The object's transform then composes on top of the parent's, so
|
|
60
|
+
* moving/rotating/scaling the parent moves its children.
|
|
61
|
+
* @param {GameObject|null} parent - The parent GameObject, or null
|
|
62
|
+
* @returns {GameObject} - this
|
|
63
|
+
*/
|
|
64
|
+
setParent(parent: GameObject | null): GameObject;
|
|
65
|
+
/**
|
|
66
|
+
* @method addChild
|
|
67
|
+
* @description Parents another GameObject to this one.
|
|
68
|
+
* @param {GameObject} child - The child GameObject
|
|
69
|
+
* @returns {GameObject} - this
|
|
70
|
+
*/
|
|
71
|
+
addChild(child: GameObject): GameObject;
|
|
72
|
+
/**
|
|
73
|
+
* @method setIsActive
|
|
74
|
+
* @description Sets the active state of the game object
|
|
75
|
+
* @param {boolean} bool - The active state
|
|
76
|
+
*/
|
|
77
|
+
setIsActive(bool: boolean): void;
|
|
78
|
+
/**
|
|
79
|
+
* @method setOpacity
|
|
80
|
+
* @description Sets the opacity of the game object (0..1)
|
|
81
|
+
* @param {number} value - The opacity value between 0 and 1
|
|
82
|
+
*/
|
|
83
|
+
setOpacity(value: number): void;
|
|
84
|
+
/**
|
|
85
|
+
* @method getOpacity
|
|
86
|
+
* @description Gets the opacity of the game object
|
|
87
|
+
* @returns {number} - The opacity value between 0 and 1
|
|
88
|
+
*/
|
|
89
|
+
getOpacity(): number;
|
|
90
|
+
/**
|
|
91
|
+
* @method getComponent
|
|
92
|
+
* @description Returns a component from the game object
|
|
93
|
+
* @param {Component} componentType - The type of component to return
|
|
94
|
+
*/
|
|
95
|
+
getComponent(componentType: Component): any;
|
|
96
|
+
/**
|
|
97
|
+
* @method getRigidBodyAtPosition
|
|
98
|
+
* @description Returns the rigidbody at a position
|
|
99
|
+
* @param {Vector2} position - The position to check
|
|
100
|
+
*/
|
|
101
|
+
getRigidBodyAtPosition(position: Vector2): RigidBody;
|
|
102
|
+
/**
|
|
103
|
+
* @method syncPhysics
|
|
104
|
+
* @description Copies simulation state (position + rotation) from this
|
|
105
|
+
* object's dynamic rigidbody onto its transform, and mirrors it onto any
|
|
106
|
+
* visible collider debug shape. Called once per frame from the render loop so
|
|
107
|
+
* draw() stays read-only and physics isn't re-applied per camera. Also
|
|
108
|
+
* forwards to components that own their own physics-driven content (e.g.
|
|
109
|
+
* InstancedTexture).
|
|
110
|
+
*/
|
|
111
|
+
syncPhysics(): void;
|
|
112
|
+
/**
|
|
113
|
+
* @method destroy
|
|
114
|
+
* @description Permanently tears the object down: disposes every Drawable's
|
|
115
|
+
* GPU resources, destroys physics bodies, and runs Behaviour.onDestroy().
|
|
116
|
+
* Use it (or Scene.remove(obj, { dispose: true })) when an object will not
|
|
117
|
+
* be re-added: plain Scene.remove() keeps GPU resources alive for re-use.
|
|
118
|
+
* Safe to call twice.
|
|
119
|
+
*/
|
|
120
|
+
destroy(): void;
|
|
121
|
+
/** @private */
|
|
122
|
+
private _destroyed;
|
|
123
|
+
/**
|
|
124
|
+
* @method draw
|
|
125
|
+
* @description Draws the game object
|
|
126
|
+
* @param {Matrix4} globalViewMatrix - The global view matrix
|
|
127
|
+
* @param {WebGLUniformLocation} uniformLocation - The uniform location
|
|
128
|
+
* @param {number} currentTime - The current time
|
|
129
|
+
*/
|
|
130
|
+
draw(globalViewMatrix: Matrix4, uniformLocation: WebGLUniformLocation, currentTime: number): void;
|
|
131
|
+
}
|
|
132
|
+
import Transform from "../Transform.js";
|
|
133
|
+
import { Vector2 } from "../Physics.js";
|
|
134
|
+
import RigidBody from "./RigidBody.js";
|
|
135
|
+
import { Vector3 } from "../Physics.js";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export default PolygonCollider;
|
|
2
|
+
/**
|
|
3
|
+
* @class PolygonCollider
|
|
4
|
+
* @extends Collider
|
|
5
|
+
* @description A convex-polygon fixture, for collision shapes a box or
|
|
6
|
+
* circle can't approximate, like ramps, wedges, or arbitrary tile outlines (see
|
|
7
|
+
* {@link ForgeLevel}). Points outside the convex hull of what you pass are
|
|
8
|
+
* dropped automatically; a concave shape needs more than one collider.
|
|
9
|
+
* @param {Rigidbody} rigidbody - The rigidbody to attach the collider to
|
|
10
|
+
* @param {Array<{x:number,y:number}>} points - Local-space points, in
|
|
11
|
+
* physics units, in any order
|
|
12
|
+
* @param {number} density - The density of the collider
|
|
13
|
+
* @param {number} friction - The friction of the collider
|
|
14
|
+
* @param {number} restitution - The restitution of the collider
|
|
15
|
+
* @param {boolean} [isSensor=false] - Whether the collider is a sensor
|
|
16
|
+
* @param {GameObject} [parentObject=null] - The parent object of the collider
|
|
17
|
+
* @param {Object} [filter=null] - Collision filter spec, see {@link Collider#setFilter}
|
|
18
|
+
*/
|
|
19
|
+
declare class PolygonCollider extends Collider {
|
|
20
|
+
constructor(rigidbody: any, points: any, density: any, friction: any, restitution: any, isSensor?: boolean, parentObject?: any, filter?: any);
|
|
21
|
+
collider: any;
|
|
22
|
+
points: any;
|
|
23
|
+
/**
|
|
24
|
+
* @method getPoints
|
|
25
|
+
* @description Returns the local-space points this collider was built from
|
|
26
|
+
* @returns {Array<{x:number,y:number}>}
|
|
27
|
+
*/
|
|
28
|
+
getPoints(): Array<{
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
}>;
|
|
32
|
+
}
|
|
33
|
+
import Collider from "./Collider.js";
|