logo
OrbitMover

movement

OrbitMover

1
Unlock

Install with the CLI:

bjs download OrbitMover

OrbitMover

Sweeps a mesh around a fixed center on a circle — a moving target with no input wiring.

What it does

The System processes every entity carrying OrbitMover + MeshPrimitive. Each frame it advances angle by speed * dt, places the mesh at (centerX + cos(angle)·radius, centerY, centerZ + sin(angle)·radius), and pushes that through the adapter with setMeshPosition. When faceMotion is on it also yaws the mesh to point along its direction of travel via setMeshRotation. It emits and consumes no events — the motion is self-contained, which makes it the cheapest way to give a camera-follow or look-at mechanic something that actually moves without authoring keyboard control.

Use it in a scene

A scene is just data — a list of entities, each with its components. At startup the SceneLoader turns this JSON into a live world; edit the file and reload to rebuild it.

Fastest path

bjs download scene OrbitMover

Pulls this exact scene into your project and runs it — no copy-paste. Add --all to grab the components and assets it needs too.

Or build it from scratch with the bjs CLI:

  1. 1Scaffold a project
    npm create @babylonjsmarket/arcade@latest my-game

    World, renderer, and dev server — ready to run.

  2. 2Install dependencies
    cd my-game && npm install
  3. 3Add OrbitMover
    bjs download OrbitMover

    Copies its source into src/ so the scene resolves.

    First time? Run bjs login once.

  4. 4Paste the scene into src/scenes/arcade-room.ts and run
    npm run dev

    SceneLoader builds the world from the JSON; reload to rebuild.

JSON
{
  "Mover": {
    "components": {
      "MeshPrimitive": {
        "primitive": "capsule",
        "radius": 0.5,
        "height": 1.6,
        "material": { "diffuseColor": [0.3, 0.85, 0.95] }
      },
      "OrbitMover": {
        "radius": 6,
        "speed": 0.8,
        "centerY": 0.8,
        "faceMotion": true
      }
    }
  }
}

Props

  • radius (number, default 5) — orbit radius in world units.
  • speed (number, default 0.8) — angular speed in radians/second.
  • centerX / centerZ (number, default 0) — center of the circle on the ground plane.
  • centerY (number, default 0) — fixed height the mesh holds while it orbits.
  • phase (number, default 0) — starting angle in radians; stored as the live angle and serialized back out as phase.
  • faceMotion (boolean, default true) — when true, yaw the mesh around Y to face the direction of travel.

Dependencies

MeshPrimitive — supplies the mesh handle the System moves. The query requires both components, so an OrbitMover on an entity with no MeshPrimitive is inert.

Notes

  • The System writes the new position into mesh.position / mesh.rotation as well as calling the adapter, so a save mid-orbit captures where the mesh actually is.
  • An entity whose MeshPrimitive hasn't resolved a handle yet is skipped that frame rather than throwing — the orbit starts once the mesh exists.
  • phase lets multiple movers share one center without overlapping: space them evenly (e.g. 0, 2.09, 4.19 for three) to spread them around the ring.

More like this

MeshPrimitive
AiDriver
AiPilot
Animation
ArcCamera
Asteroid
BoatMode
Bullet
CameraFollow
CarDrive
DirectionalLight
EnemySpawner
EnvironmentTexture
FreighterCar
FreighterChain
FreighterHead
GameConfig
GravityBody
GravityMass
Hand
Health
HemisphericLight
Jump
KeyboardInput
KeyboardMover
Lifetime
LineOfSight
MachineGun
Mesh
Missile
MissileLauncher
MissionDirector
MouseInput
Movement
Obstacle
ObstacleField
OilBlob
Parts
Physics
PlayerInput
PlayerWalkAnimator
RespawnTimer
RoundReset
Score
Shadow
ShipFlight
ShipLoadout
SkeletonAnimator
SpaceShooterBullet
SpaceShooterHealth
SpaceShooterScore
Spin
TrafficConvoy
Transform6DOF
TwinStickEnemy
Velocity6DOF
WaveDirector
Waypoint
WaypointTrack
WorldOriginAnchor

Was this page helpful?

We read every note — tell us what's working and what isn't.

↑↓ NavigateEnter SelectEsc CloseCtrl+K Open Search