Skip to content

PhysicsAPI

Beta
PhysicsAPI is an interface which defines properties, events, and functions for objects which simulates physics.

Functions

PhysicsEntity PhysicsAPI.Physics(YaEntity entity)Beta
void PhysicsAPI.OnHitEnter(function callback<YaEntity, YaEntity, number, float3>)Beta
Fired when the entity has been hit.
void PhysicsAPI.OnTriggerEnter(function callback<YaEntity, YaEntity>)Beta
Fired when the character enters a trigger.
void PhysicsAPI.OnTriggerExit(function callback<YaEntity, YaEntity>)Beta
Fired when the character exit a trigger.
void PhysicsAPI.OnContactEnter(function callback<YaEntity, YaEntity>)Beta
Fired when the character enters another character or rigidbody.
void PhysicsAPI.OnContactExit(function callback<YaEntity, YaEntity>)Beta
Fired when the character exits another character or rigidbody.
void PhysicsAPI.AddForce(YaEntity entity, float3 force)Beta
Applies a force to the rigidbody.
  • entity Indicates the rigidbody to applied a force.
  • force force
void PhysicsAPI.AddImpulseForce(YaEntity entity, float3 force)Beta
Applies an impulse to the rigidbody.
  • entity The rigidbody to applies an impulse.
  • force force
void PhysicsAPI.AddTorque(YaEntity entity, float3 torque)Beta
Applies a torque to the rigidbody.
  • entity The rigidbody to apply a torque.
  • torque Torque
void PhysicsAPI.AddForceAtPos(YaEntity entity, float3 force, float3 pos)Beta
Applies a force at the specified position.
void PhysicsAPI.AddForceAtLocalPos(YaEntity entity, float3 force, float3 pos)Beta
Applies a force at the specified local position.
void PhysicsAPI.AddLocalForceAtLocalPos(YaEntity entity, float3 force, float3 pos)Beta
Applies a local force at the specified local position.
void PhysicsAPI.AddExplosionImpulseForce(YaEntity entity, number explosionForce, float3 explosionPosition, number radius, number upwardsModifier)Beta
Applies an explosion at the specified position.
void PhysicsAPI.SetAngularVelocity(YaEntity entity, float3 angVel)Beta
Sets the angular velocity.
  • angVel angle velocity
void PhysicsAPI.SetLinearVelocity(YaEntity entity, float3 linVel)Beta
Sets the linear velocity.
  • linVel linear velocity
float3? PhysicsAPI.GetAngularVelocity(YaEntity entity)Beta
Gets the angular velocity.
float3? PhysicsAPI.GetLinearVelocity(YaEntity entity)Beta
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
void PhysicsAPI.SetCollidable(YaEntity entity, boolean value)Beta
Enables collisions on the entity.
boolean PhysicsAPI.InTrigger(YaEntity entity, YaEntity trigger)Beta
Checks if the entity is in the Trigger box.
YaQueryResult PhysicsAPI.RaycastSingle(float3 origin, float3 direction, YaQueryParameter parameter)Beta
Returns only the first entity contacted with the raycast.
  • origin origin
  • direction direction
  • parameter refer to YaQueryParameter
YaEntity[] PhysicsAPI.Overlap(float3 origin, YaQueryParameter parameter)Beta
Queries for all entities in a certain area.
  • origin origin