Class
Gravity3D
View sourceExtendsVector3
Stores the world’s 3D gravity acceleration as a mutable Vector3
resource.
A directly constructed Gravity3D starts at (0, 0, 0). Gravity3DPlugin
installs the resource with a default value of (0, -980, 0), or with the
configured acceleration supplied to the plugin. The resource can be read or
replaced through the world’s resource API.
Examples
import { Gravity3D } from '@wimaengine/gravity'
import { World } from '@wimaengine/ecs'
const world = new World()
world.setResource(new Gravity3D(0, -9.8, 0))
const gravity = world.getResource(Gravity3D)
console.log(gravity.y) // -9.8