@emile/engine / physics/world / PhysicsWorld
Class: PhysicsWorld
Defined in: src/physics/world.ts:29
Represents a physics world.
The physics world has a system priority of 0. You can give your systems a higher priority to run before the physics world.
Extends
Constructors
new PhysicsWorld()
new PhysicsWorld(
options
):PhysicsWorld
Defined in: src/physics/world.ts:57
Creates a new physics world.
Parameters
options
The options for the physics world.
Returns
PhysicsWorld
Overrides
Properties
dispose()?
readonly
optional
dispose: (data
) =>void
Defined in: src/ecs/system.ts:95
The function to run when the system is disposed.
Parameters
data
The data for the disposal.
Returns
void
Inherited from
priority
readonly
priority:number
Defined in: src/ecs/system.ts:44
The priority of the system.
Systems with a higher priority will run before systems with a lower priority.
Inherited from
query
readonly
query:EntityQuery
Defined in: src/ecs/system.ts:28
The query to match entities.
An empty query will match all entities.
This should not be changed after the system is created.
Inherited from
queryKey
readonly
queryKey:string
Defined in: src/ecs/system.ts:37
The key of the query.
This is used internally by the registry.
Do not change this value.
Inherited from
stateUpdate()?
readonly
optional
stateUpdate: (data
) =>void
Defined in: src/ecs/system.ts:88
The function to run on state updates.
Parameters
data
The data for the update.
Returns
void
Inherited from
type
readonly
type:SystemType
Defined in: src/ecs/system.ts:53
The type of the system.
This should not be changed after the system is created.
Note
This is used to determine if the system should run on the client, server, or both.
Inherited from
update()?
readonly
optional
update: (data
) =>void
Defined in: src/ecs/system.ts:74
The function to run on updates.
Parameters
data
The data for the update.
Returns
void
Inherited from
Methods
fixedUpdate()
fixedUpdate(
__namedParameters
):void
Defined in: src/physics/world.ts:73
The function to run on fixed updates.
Parameters
__namedParameters
Returns
void
Overrides
System.fixedUpdate
getGravity()
getGravity():
Vec2
Defined in: src/physics/world.ts:230
Gets the gravity of the physics world.
Returns
The gravity of the physics world.
queryRay()
Call Signature
queryRay(
start
,end
):RayCol
[]
Defined in: src/physics/world.ts:242
Queries the world for bodies that intersect with a ray.
Parameters
start
The start of the ray.
end
The end of the ray.
Returns
RayCol
[]
The bodies that intersect with the ray.
Call Signature
queryRay(
origin
,dir
,len
):RayCol
[]
Defined in: src/physics/world.ts:253
Queries the world for bodies that intersect with a ray.
Parameters
origin
The origin of the ray.
dir
The direction of the ray.
len
number
The length of the ray.
Returns
RayCol
[]
The bodies that intersect with the ray.
setGravity()
setGravity(
gravity
):void
Defined in: src/physics/world.ts:220
Sets the gravity of the physics world.
Parameters
gravity
The gravity to set.
Returns
void
getCollider()
static
getCollider(entity
):null
|Collider
Defined in: src/physics/world.ts:30
Parameters
entity
Returns
null
| Collider