Creates a new physics World.
world = lovr.physics.newWorld(settings)
Arguments
Name | Type | Default | Description |
settings | table | |
An optional table with settings for the physics simulation.
|
.tags | table | {} |
The list of collision tags (strings). Colliders can be assigned a tag, and collision can be enabled and disabled between different tags. There is a maximum of 31 tags.
|
.staticTags | table | {} |
An optional list of collision tags that are "static". Colliders with a static tag will not move, and the physics engine uses this for optimization.
|
.maxColliders | number | 16384 |
The maximum number of Colliders in the World. Increasing this will use more memory. This can't be bigger than 2^23 (around 8 million).
|
.threadSafe | boolean | true |
Whether the World and the objects it contains can be used from multiple threads. This will use a set of locks to ensure only one thread can access a Collider at a given time. Disable this to potentially get a small performance boost when only using the World from a single Thread.
|
.allowSleep | boolean | true |
Whether colliders should be allowed to go to sleep when they come to rest. Sleeping colliders don't need to simulate movement until something hits them. This improves performance a lot for a typical physics scene where many objects are at rest.
|
.stabilization | number | 0.2 |
How quickly the physics engine corrects position error from collisions and joints, from 0 to 1. If the value is too low, objects will be spongy, but if it's too high then physics will explode. Values between .2 and .8 are recommended.
|
.maxPenetration | number | .01 |
The maximum amount that colliders are allowed to overlap, in meters.
|
.restitutionThreshold | number | 1.0 |
A velocity below which restitution (bounciness) will not be applied, in meters per second. If this is too low then objects may have trouble coming to rest.
|
.velocitySteps | number | 10 |
The number of solver velocity iterations to run per tick. This must be at least 2. Larger values will increase accuracy but use more CPU.
|
.positionSteps | number | 2 |
The number of solver position iterations to run per tick. Larger values will increase accuracy but use more CPU.
|
Returns
Name | Type | Description |
world | World |
A whole new World.
|
See also