Table of Contents

Class PhysicsWorld

Namespace
PopcorningGuineaPig.Engine.Physics
Assembly
PopcorningGuineaPig.Engine.dll

Thin Box3D world. The only engine type that may mention b3*. Construct per scene; dispose with the scene. Single-threaded.

public sealed class PhysicsWorld : IDisposable
Inheritance
PhysicsWorld
Implements
Inherited Members

Constructors

PhysicsWorld(Vector3?)

public PhysicsWorld(Vector3? gravity = null)

Parameters

gravity Vector3?

Methods

CreateDynamicBox(Vector3, Vector3, float, float)

public PhysicsBodyId CreateDynamicBox(Vector3 center, Vector3 halfExtents, float density = 1, float friction = 0.3)

Parameters

center Vector3
halfExtents Vector3
density float
friction float

Returns

PhysicsBodyId

CreateStaticBox(Vector3, Vector3)

public PhysicsBodyId CreateStaticBox(Vector3 center, Vector3 halfExtents)

Parameters

center Vector3
halfExtents Vector3

Returns

PhysicsBodyId

CreateStaticHull(ReadOnlySpan<Vector3>)

Static convex hull from world-space points. Used for Quake brushes (#403). Returns a null id if Box3D rejects the point cloud.

public PhysicsBodyId CreateStaticHull(ReadOnlySpan<Vector3> points)

Parameters

points ReadOnlySpan<Vector3>

Returns

PhysicsBodyId

DestroyBody(PhysicsBodyId)

public void DestroyBody(PhysicsBodyId id)

Parameters

id PhysicsBodyId

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

GetPosition(PhysicsBodyId)

public Vector3 GetPosition(PhysicsBodyId id)

Parameters

id PhysicsBodyId

Returns

Vector3

GetRotation(PhysicsBodyId)

public Quaternion GetRotation(PhysicsBodyId id)

Parameters

id PhysicsBodyId

Returns

Quaternion

Move(CharacterMover, Vector3)

Swept capsule move + plane solve + velocity clip. Mutates mover position and velocity.

public void Move(CharacterMover mover, Vector3 translation)

Parameters

mover CharacterMover
translation Vector3

OverlapSphere(Vector3, float)

public bool OverlapSphere(Vector3 center, float radius)

Parameters

center Vector3
radius float

Returns

bool

RayCast(Vector3, Vector3)

Closest ray. translation is the full sweep (end − start).

public PhysicsHit RayCast(Vector3 origin, Vector3 translation)

Parameters

origin Vector3
translation Vector3

Returns

PhysicsHit

ShapeCastSphere(Vector3, float, Vector3)

Swept sphere. translation is the full sweep.

public PhysicsHit ShapeCastSphere(Vector3 origin, float radius, Vector3 translation)

Parameters

origin Vector3
radius float
translation Vector3

Returns

PhysicsHit

Step(float)

public void Step(float dt)

Parameters

dt float