Behaviors
Behaviorsπ
Behaviors are data-driven animations that stack on entities β no scripting required. Multiple behaviors can be combined on a single entity for complex motion.
Each is a function of time from the entityβs authored transform, as the Open World Format states it: every frame starts from where the entity was placed, then the behaviors apply in the order they were added, each from what the ones before it left. A spin, pulse or swing acts about a pivot β a point in the entityβs local frame, in metres before its scale, the origin by default β that stays where the authored transform put it while the rest turns or scales around it: [0, -h/2, 0] makes a wheel of a spin or keeps a breathing thing on the ground, [0, h/2, 0] hangs a swing from its top. A phase is time already spent, in degrees.
Behavior Typesπ
orbitπ
Rotate around a center point or entity.
{
"type": "orbit",
"center": "sun", // Entity name to orbit around (optional)
"center_point": [0, 0, 0], // Or explicit center point
"radius": 5.0,
"speed": 30.0, // Degrees per second
"axis": [0, 1, 0], // Rotation axis (default: Y)
"phase": 0.0, // Starting angle in degrees
"tilt": 0.0 // Tilt the orbit plane in degrees
}spinπ
Continuous rotation around local axes.
{
"type": "spin",
"axis": [0, 1, 0],
"speed": 90.0, // Degrees per second
"phase": 0.0, // Degrees already turned at time zero
"pivot": [0, 0, 0] // The local point it turns about; [0, -h/2, 0] makes a wheel
}bobπ
Sinusoidal oscillation along an axis.
{
"type": "bob",
"axis": [0, 1, 0],
"amplitude": 1.0,
"frequency": 1.0, // Hz
"phase": 0.0 // Starting phase in degrees
}look_atπ
Continuously face toward a target entity.
{
"type": "look_at",
"target": "camera" // Entity name to track
}pulseπ
Scale breathing effect.
{
"type": "pulse",
"min_scale": 0.9,
"max_scale": 1.1,
"frequency": 2.0, // Hz
"phase": 0.0, // Starting phase in degrees
"pivot": [0, 0, 0] // The local point it scales about; [0, -h/2, 0] keeps it on the ground
}swingπ
A pendulum: rocks about a hinge through its pivot.
{
"type": "swing",
"axis": [1, 0, 0], // The hinge (default: X)
"amplitude": 30.0, // Degrees each way
"frequency": 0.5, // Rocks per second
"phase": 0.0, // Starting phase in degrees
"pivot": [0, 0.6, 0] // The point it hangs from; [0, h/2, 0] is its top
}path_followπ
Follow a path of waypoints in sequence.
{
"type": "path_follow",
"waypoints": [[0, 0, 0], [5, 0, 0], [5, 0, 5], [0, 0, 5]],
"speed": 2.0, // Units per second
"mode": "loop", // "loop", "ping_pong", or "once"
"orient_to_path": true // Face direction of movement
}bounceπ
Gravity-based bouncing with damping.
{
"type": "bounce",
"height": 3.0, // Initial bounce height
"gravity": 9.8, // Acceleration (units/sΒ²)
"damping": 0.7, // Energy retained per bounce (0-1)
"surface_y": 0.0 // Ground level
}Composing Behaviorsπ
Multiple behaviors can be added to a single entity. They execute in sequence each frame, from the authored transform, each from what the ones before it left β so a wheel (a spin about its base) can bob on its axle:
// Add orbit around a point
gen_add_behavior({
"entity": "planet",
"behavior": {
"type": "orbit",
"center_point": [0, 0, 0],
"radius": 10.0,
"speed": 20.0
}
})
// Add spin on its own axis
gen_add_behavior({
"entity": "planet",
"behavior": {
"type": "spin",
"axis": [0, 1, 0],
"speed": 45.0
}
})
// Add subtle bob for atmosphere
gen_add_behavior({
"entity": "planet",
"behavior": {
"type": "bob",
"axis": [0, 1, 0],
"amplitude": 0.2,
"frequency": 0.5
}
})Managing Behaviorsπ
// List all behaviors on an entity
gen_list_behaviors({ "entity": "planet" })
// Remove a specific behavior
gen_remove_behavior({
"entity": "planet",
"behavior_id": "orbit_0"
})
// Pause all behaviors globally
gen_pause_behaviors({ "paused": true })
// Resume behaviors
gen_pause_behaviors({ "paused": false })