ParelVRDocs
Player site

Scripting / Reference

Physics

Types in the ParelVR.Volt.Physics namespace.

VoltCollision#

ParelVR.Volt.Physics.VoltCollision class

Details of a collision.

VoltCollision properties#

VoltCollider Collider { get; }

The other collider. Null when it is not part of the world.

VoltGameObject GameObject { get; }

The other object.

Vector3 Impulse { get; }

The impulse the collision applied.

Vector3 Normal { get; }

The surface direction at the first point of contact.

Vector3 Point { get; }

The first point of contact.

Vector3 RelativeVelocity { get; }

How fast the two were moving toward each other.

VoltRigidbody Rigidbody { get; }

The other rigidbody, if it has one.

VoltPhysics#

ParelVR.Volt.Physics.VoltPhysics static

Queries against the world's colliders. A query can hit a player, but it never hands a script anything that belongs to ParelVR itself: such hits report a point and a distance and nothing else.

VoltPhysics properties#

static Vector3 Gravity { get; }

The world's gravity.

VoltPhysics methods#

static bool BoxCast(Vector3 center, Vector3 halfExtents, Vector3 direction, VoltRaycastHit hit, Quaternion orientation, float maxDistance, int layerMask)

Sweeps a box along a ray and reports the nearest hit.

static bool CapsuleCast(Vector3 point1, Vector3 point2, float radius, Vector3 direction, VoltRaycastHit hit, float maxDistance, int layerMask)

Sweeps a capsule along a ray and reports the nearest hit.

static bool CheckBox(Vector3 center, Vector3 halfExtents, Quaternion orientation, int layerMask)

True when any collider overlaps a box.

static bool CheckCapsule(Vector3 start, Vector3 end, float radius, int layerMask)

True when any collider overlaps a capsule.

static bool CheckSphere(Vector3 position, float radius, int layerMask)

True when any collider overlaps a sphere.

static int LayerMask(string layerName)

The mask for one layer, by name. Zero when there is no such layer.

static VoltCollider[] OverlapBox(Vector3 center, Vector3 halfExtents, Quaternion orientation, int layerMask)

The world colliders that overlap a box. At most 64.

static VoltCollider[] OverlapSphere(Vector3 position, float radius, int layerMask)

The world colliders that overlap a sphere. At most 64.

static VoltPlayer[] OverlapSpherePlayers(Vector3 position, float radius)

The players inside a sphere.

static bool Raycast(Vector3 origin, Vector3 direction, VoltRaycastHit hit, float maxDistance)

Casts a ray and reports the nearest hit.

static bool Raycast(Vector3 origin, Vector3 direction, VoltRaycastHit hit, float maxDistance, int layerMask)

Casts a ray against some layers and reports the nearest hit.

static bool Raycast(Vector3 origin, Vector3 direction, float maxDistance)

True when a ray hits something within a distance.

static VoltRaycastHit[] RaycastAll(Vector3 origin, Vector3 direction, float maxDistance, int layerMask)

Casts a ray and reports every hit, nearest first. At most 64 hits.

static bool SphereCast(Vector3 origin, float radius, Vector3 direction, VoltRaycastHit hit, float maxDistance, int layerMask)

Sweeps a sphere along a ray and reports the nearest hit.

VoltRaycastHit#

ParelVR.Volt.Physics.VoltRaycastHit class

What a ray or a shape cast hit.

VoltRaycastHit properties#

VoltCollider Collider { get; }

The collider that was hit. Null when the hit was a player or something outside the world.

float Distance { get; }

Distance from the start of the cast to the hit.

VoltGameObject GameObject { get; }

The object that was hit. Null when the hit was a player or something outside the world.

Vector3 Normal { get; }

The direction the surface faces at the hit.

VoltPlayer Player { get; }

The player that was hit, or null.

Vector3 Point { get; }

Where the hit happened, in world space.

VoltTransform Transform { get; }

The transform that was hit.