Applies a force to a physics body at a given location.
The force vector to apply.
Optional
location: Vector3 | [number, number, number]The location in world space to apply the impulse.
This method is useful for applying a force to a physics body at a given location. This can be used to simulate physical forces such as explosions, collisions, and gravity.
If location is not provided, the force will be applied to the center of the body.
Applies an impulse to a physics body at a given location.
The impulse vector to apply.
Optional
location: Vector3 | [number, number, number]The location in world space to apply the impulse.
This method is useful for applying an impulse to a physics body at a given location. This can be used to simulate physical forces such as explosions, collisions, and gravity.
If location is not provided, the impulse will be applied to the center of the body.
Gets the angular damping of a physics body.
The angular damping of the body.
This function is useful for retrieving the angular damping of a physics body, which is used to control the rotational motion of the body. The angular damping is a value between 0 and 1, where 0 is no damping and 1 is full damping.
Gets the motion type of a physics body.
Get the instance of the ZComponent that constructed this entity.
If you pass the class of a ZComponent as the type
parameter, this function will ensure that it
returns an instance of that ZComponent. If this component or behavior was constructed by a different
ZComponent class, or by a different entity altogether, the function with throw
an error.
Optional
type: ConstructorForComponent<T>The ZComponent class that you are expecting to receive
The instance of the ZComponent that constructed this component or behavior
Register a function to be called when an Event is fired, or an Observable's value changes. The function will only be bound to the underlying Event or Observable while this entity is enabled.
Using this function, rather than attaching your handler directly to the Event or Observable, ensures your handler is automatically released when this entity is disposed.
Rest
...args: ArgsOptional
options: RegisterOptionsOptional
options: RegisterOptionsSets the angular damping of a physics body.
The angular damping value to set.
This function is useful for controlling the angular velocity of a physics body. By setting the angular damping, the body's angular velocity will be reduced over time, allowing for more realistic physics simulations.
Sets the linear damping of the given body.
The linear damping to set.
This method is useful for controlling the linear damping of a body in a physics engine. Linear damping is a force that opposes the motion of the body, and is proportional to the velocity of the body. This method allows the user to set the linear damping of a body, which can be used to control the motion of the body.
Sets the motion type of a physics body. Can be STATIC, DYNAMIC, or KINEMATIC.
Readonly
enabledIf false
, this entity and its children will no longer participate in the experience.
Note - to read this value, you may wish to use enabledResolved
which will be false
if
this entity, or any of its parents, have enabled
set to false.
The precise implications of enabled
being false will vary between entities,
but in general disabled entities:
Sets the bounciness of the physics material.z
The bounciness is a factor which describes, the amount of energy that is retained after a collision, which should be a number between 0 and 1..
A bounciness of 0 means that no energy is retained and the objects will not bounce off each other, while a bounciness of 1 means that all energy is retained and the objects will bounce.
Note, though, due that due to the simulation implementation, an object with a bounciness of 1 may still lose energy over time.
If not provided, a default value of 0 will be used.
Sets the friction used by this material
The friction determines how much an object will slow down when it is in contact with another object. This is important for simulating realistic physics, such as when an object slides across a surface.
If not provided, a default value of 0.5 will be used.
Sets the angular damping of a physics body.
This function is useful for controlling the angular velocity of a physics body. By setting the angular damping, the body's angular velocity will be reduced over time, allowing for more realistic physics simulations.
Sets the linear damping of the given body.
This method is useful for controlling the linear damping of a body in a physics engine. Linear damping is a force that opposes the motion of the body, and is proportional to the velocity of the body. This method allows the user to set the linear damping of a body, which can be used to control the motion of the body.
Sets the density of a physics shape.
When true, the object can be picked up using the RigidbodyGrabber
component.
The rigid body must have a DYNAMIC
motion type to be grabbable.
Sets the gravity factor of a body.
Defaults to the center of the rigid body. The center of mass, in local space. This is The point the body will rotate around when applying an angular velocity.
If not provided, the physics engine will compute an appropriate value.
The principal moments of inertia of this object for a unit mass. This determines how easy it is for the body to rotate. A value of zero on any axis will be used as infinite interia about that axis.
If not provided, the physics engine will compute an appropriate value.
The rotation rotating from inertia major axis space to parent space (i.e., the rotation which, when applied to the 3x3 inertia tensor causes the inertia tensor to become a diagonal matrix). This determines how the values of inertia are aligned with the parent object.
If not provided, the physics engine will compute an appropriate value.
The total mass of this object, in kilograms. This affects how easy it is to move the body. A value of zero will be used as an infinite mass.
If not provided, the physics engine will compute an appropriate value.
Identifier for the physics body associated with this collider in the physics world.
Identifier for the shape used in the physics engine.
Readonly
contextReadonly
enabledThis will have value false
if this entity, or any of its parents, have enabled
set to false
.
To change the enabled
status of this entity, use the enabled
property instead.
The precise implications of enabled
being false will vary between entities,
but in general disabled entities:
Disabled entities will typically remain visible (if they have a visible appearance).
Readonly
instanceSets the motion type of a physics body.
Static: The body is not affected by forces or collisions. It remains fixed in place unless moved manually. Use this for objects that should not move or interact with other physics objects, such as walls or stationary obstacles.
Dynamic: The body is affected by forces and collisions. It responds to gravity, collisions, and other physical interactions. Use this for objects that should have realistic physics behavior, such as falling boxes, projectiles, or characters.
Kinematic: The body is not affected by forces, but can be moved by setting its transform. It does not respond to collisions. Use this for objects that need to be animated or moved programmatically, such as moving platforms or camera-controlled objects. Note: Kinematic objects can suffer from teleportation issues and may clip through other objects if animated too quickly.
Readonly
onAn event that is fired as the last act of this entity being destroyed.
Emit when a RigidbodyGrabber grabs the object.
Emitted when a RigidbodyGrabber is within range of the object.
Emitted when a RigidbodyGrabber is within range of the object.
Emitted when a RigidbodyGrabber releases the object.
Emitted when the rigid body is ready to be used.
Gets the disposed status of the entity.