ReferenceScripting APIStagesetGravity
Stage.setGravity
methodSets a world's gravity.
| Name | setGravity |
|---|---|
| Kind | method of Stage |
| Called as | stage.setGravity(…) |
| As a node | Set Gravity (logic graph) |
| Since | 0.4 |
Syntax
setGravity( v: Place, world?: "2d" | "3d"): voidParameters
| Name | Type | Description |
|---|---|---|
v | Place | The gravity: pixels a second a second, y down, in 2D; metres, y up, in 3D |
world | "2d" | "3d" | Optional. "2d" (unless given) or "3d" |
Returns
Nothing.
Example
import { stage } from "motion";stage.setGravity({ x: scene.weather?.wind ?? 0, y: 980 });Notes from the community
Written by creators and checked by the docs' editors. Not part of Motion's official reference.