WheelContact
Since 0.6
{@link Wheel.contact}: where the tyre touches the ground.
Signature
export interface WheelContact {
/** World space. */
point: Vec3
/** The ground's normal there, unit length. */
normal: Vec3
/** What it stands on. */
entity: EntityHandle
}
Import: import type { WheelContact } from "@argus/api"
Members
| Member | Signature | Description |
|---|---|---|
point | point: Vec3 | World space. |
normal | normal: Vec3 | The ground's normal there, unit length. |
entity | entity: EntityHandle | What it stands on. |
Example
The tested fixture fixtures/host/door.ts.
import type { Behavior } from "@argus/api"
// docs/API.md, "Joints": a door on a hinge that swings open while the player is near and closes
// behind them. Typechecked by packages/api's tests.
export default {
update(ctx) {
const player = ctx.world.find("player")
const near = player !== null && ctx.entity.distanceTo(player) < 2
ctx.joint?.setMotor(near ? Math.PI / 2 : 0, { mode: "position", maxForce: 200 })
},
} satisfies Behavior