PhysicsAPI¶
Beta
PhysicsAPI
is an interface which defines properties, events, and functions for objects which simulates physics.Functions¶
Instantiates a PhysicsEntity.
Fired when the entity has been hit.
callback
callback functionentity
The entity that has been enteredcollider
The entity that was hitdirection
The direction in which the hit comes: 0 from the sides, 1 from the top, -1 from the down sidepoint
the normal of contact point
Fired when the entity has been hit by a character.
callback
callback functionYaEntity
The entity that has been hitint
The direction in which the hit comes: 0 from the sides, 1 from the top, -1 from the down sidefloat3
The normal of contact point
Fired when the entity stops being hit by the character.
callback
callback functionYaEntity
The entity that has been hit
Fired when the character enters a trigger.
callback
callback functiontrigger
The entity that has been enteredentity
The entity involved in this collision
Fired when the entity enters a trigger box.
callback
callback functionYaEntity
The entity that enters a trigger box
Fired when the character exit a trigger.
callback
callback functiontrigger
The entity involved in this collisionentity
The entity that has been entered
Fired when the entity exits a trigger box.
callback
callback functionYaEntity
The entity that enters a trigger box
Fired when the character enters another character or rigidbody.
Fired when the character exits another character or rigidbody.
Fired when the entity exits another character or rigidbody.
Applies a force to the rigidbody.
entity
The rigidbody to apply a force toforce
Force vector
Applies an impulse to the rigidbody.
entity
The rigidbody to applies an impulse.force
Force vector
Applies a torque to the rigidbody.
entity
The rigidbody to apply a torque.torque
Torque vector
Applies a force at the specified position.
entity
The rigidbody to apply a forceforce
Force vectorpos
Global position vector
Applies a force at the specified local position.
entity
The rigidbody to apply a forceforce
Force vectorpos
Local position vector
Applies a local force at the specified local position.
entity
The rigidbody to apply a forceforce
Local Force vectorpos
Local position vector
void PhysicsAPI.AddExplosionImpulseForce(YaEntity entity, number explosionForce, float3 explosionPosition, number radius, number upwardsModifier)Beta
Applies an explosion at the specified position.
entity
The rigidbody to apply an explosionexplosionForce
The force of the explosionexplosionPosition
The centre of the sphere within which the explosion has its effectradius
The radius of the sphere within which the explosion has its effectupwardsModifier
Adjustment to the apparent position of the explosion to make it seem to lift objects
Sets the angular velocity.
entity
The rigidbody to apply a force toangVel
The angular velocity vector
Sets the linear velocity.
entity
The rigidbody to apply a force tolinVel
The linear velocity vector
Gets the angular velocity.
Gets the linear velocity.
void PhysicsAPI.ResetPositionAndRotation(YaEntity entity, float3 pos, quaternion rotate, boolean clearVelocity)Beta
Resets the position and rotation of the entity.
clearVelocity
Ignore physics velocity on entity
Enables collisions on the entity.
Get collisions on the entity.
Set whether the entity collides with the camera
Set the entity physics layer
Get the entity physics layer
void PhysicsAPI.CollisionGroupSetCollidable(number layer0, number layer1, boolean value)Beta
Sets the collision state between two layers
boolean PhysicsAPI.CollisionGroupGetCollidable(number layer0, number layer1)Beta
Gets the collision state between two layers
Checks if the entity is in the Trigger box.
entity
The entity to checktrigger
The trigger
YaQueryResult PhysicsAPI.RaycastSingle(float3 origin, float3 direction, YaQueryParameter parameter)Beta
Returns only the first entity contacted with the raycast.
origin
The origin point of the raycastdirection
The direction of the raycastparameter
YaQueryParameter
Returns the minimum value of the entity's physical bounding box
Returns the maximum value of the entity's physical bounding box
Queries for all entities in a certain area.
origin
origin