std-collision
Level: Atom | Entity: CollidableBody | Persistence: runtime
2 states, 4 events, 5 transitions
Live Preview
orbital CollidableBodyOrbital {
entity CollidableBody [runtime] {
id : string
name : string
description : string
status : string
createdAt : string
x : number
y : number
collisionStatus : string
targetId : string
}
trait CollidableBodyCollision -> CollidableBody [interaction] {
initial: idle
state idle {
INIT -> idle
(render-ui main { type: "stack", direction: "vertical", gap: "lg", children: [{ type: "stack", direction: "horizontal", gap: "md", align: "center", justify: "space-between", children: [{ type: "stack", direction: "horizontal", gap: "md", align: "center", children: [{ type: "icon", name: "crosshair", size: "lg" }, { type: "typography", content: "CollidableBody Collision", variant: "h2" }] }, { type: "status-dot", status: "inactive", label: "Idle" }] }, { type: "divider" }, { type: "simple-grid", columns: 2, children: [{ type: "stat-display", label: "X", value: ["object/get", ["array/first", "@entity"], "x"] }, { type: "stat-display", label: "Y", value: ["object/get", ["array/first", "@entity"], "y"] }] }, { type: "stack", direction: "horizontal", gap: "sm", justify: "center", children: [{ type: "button", label: "Check", event: "CHECK", variant: "primary", icon: "scan" }] }] })
CHECK -> detecting
(set @entity.collisionStatus detecting)
(render-ui main { type: "stack", direction: "vertical", gap: "lg", children: [{ type: "stack", direction: "horizontal", gap: "md", align: "center", justify: "space-between", children: [{ type: "stack", direction: "horizontal", gap: "md", align: "center", children: [{ type: "icon", name: "crosshair", size: "lg" }, { type: "typography", content: "CollidableBody Collision", variant: "h2" }] }, { type: "status-dot", status: "warning", pulse: true, label: "Detecting" }] }, { type: "divider" }, { type: "alert", variant: "warning", message: "Collision detection in progress..." }, { type: "simple-grid", columns: 2, children: [{ type: "stat-display", label: "X", value: ["object/get", ["array/first", "@entity"], "x"] }, { type: "stat-display", label: "Y", value: ["object/get", ["array/first", "@entity"], "y"] }] }, { type: "typography", variant: "caption", color: "muted", content: ["object/get", ["array/first", "@entity"], "targetId"] }, { type: "stack", direction: "horizontal", gap: "sm", justify: "center", children: [{ type: "button", label: "Clear", event: "CLEAR", variant: "ghost", icon: "x" }] }] })
}
state detecting {
COLLISION_DETECTED -> detecting
(set @entity.targetId @payload.targetId)
(set @entity.collisionStatus detected)
(render-ui main { type: "stack", direction: "vertical", gap: "lg", children: [{ type: "stack", direction: "horizontal", gap: "md", align: "center", justify: "space-between", children: [{ type: "stack", direction: "horizontal", gap: "md", align: "center", children: [{ type: "icon", name: "crosshair", size: "lg" }, { type: "typography", content: "CollidableBody Collision", variant: "h2" }] }, { type: "status-dot", status: "warning", pulse: true, label: "Detecting" }] }, { type: "divider" }, { type: "alert", variant: "warning", message: "Collision detection in progress..." }, { type: "simple-grid", columns: 2, children: [{ type: "stat-display", label: "X", value: ["object/get", ["array/first", "@entity"], "x"] }, { type: "stat-display", label: "Y", value: ["object/get", ["array/first", "@entity"], "y"] }] }, { type: "typography", variant: "caption", color: "muted", content: ["object/get", ["array/first", "@entity"], "targetId"] }, { type: "stack", direction: "horizontal", gap: "sm", justify: "center", children: [{ type: "button", label: "Clear", event: "CLEAR", variant: "ghost", icon: "x" }] }] })
CLEAR -> idle
(set @entity.collisionStatus idle)
(set @entity.targetId "")
(render-ui main { type: "stack", direction: "vertical", gap: "lg", children: [{ type: "stack", direction: "horizontal", gap: "md", align: "center", justify: "space-between", children: [{ type: "stack", direction: "horizontal", gap: "md", align: "center", children: [{ type: "icon", name: "crosshair", size: "lg" }, { type: "typography", content: "CollidableBody Collision", variant: "h2" }] }, { type: "status-dot", status: "inactive", label: "Idle" }] }, { type: "divider" }, { type: "simple-grid", columns: 2, children: [{ type: "stat-display", label: "X", value: ["object/get", ["array/first", "@entity"], "x"] }, { type: "stat-display", label: "Y", value: ["object/get", ["array/first", "@entity"], "y"] }] }, { type: "stack", direction: "horizontal", gap: "sm", justify: "center", children: [{ type: "button", label: "Check", event: "CHECK", variant: "primary", icon: "scan" }] }] })
INIT -> detecting
(render-ui main { type: "stack", direction: "vertical", gap: "lg", children: [{ type: "stack", direction: "horizontal", gap: "md", align: "center", justify: "space-between", children: [{ type: "stack", direction: "horizontal", gap: "md", align: "center", children: [{ type: "icon", name: "crosshair", size: "lg" }, { type: "typography", content: "CollidableBody Collision", variant: "h2" }] }, { type: "status-dot", status: "warning", pulse: true, label: "Detecting" }] }, { type: "divider" }, { type: "alert", variant: "warning", message: "Collision detection in progress..." }, { type: "simple-grid", columns: 2, children: [{ type: "stat-display", label: "X", value: ["object/get", ["array/first", "@entity"], "x"] }, { type: "stat-display", label: "Y", value: ["object/get", ["array/first", "@entity"], "y"] }] }, { type: "typography", variant: "caption", color: "muted", content: ["object/get", ["array/first", "@entity"], "targetId"] }, { type: "stack", direction: "horizontal", gap: "sm", justify: "center", children: [{ type: "button", label: "Clear", event: "CLEAR", variant: "ghost", icon: "x" }] }] })
}
}
page "/collidablebodys/collision" -> CollidableBodyCollision
}
Loading preview...
Orbital Visualization
Loading visualization...
Entity Fields
| Field | Type | Default |
|---|---|---|
| id | string | - |
| name | string | - |
| description | string | - |
| status | string | "active" |
| createdAt | string | - |
| x | number | 0 |
| y | number | 0 |
| collisionStatus | string | "idle" |
| targetId | string | "" |
States
| State | Type |
|---|---|
| idle | Initial |
| detecting | - |
Events
| Event | Payload |
|---|---|
| INIT | - |
| CHECK | - |
| COLLISION_DETECTED | targetId: string |
| CLEAR | - |
Transitions
| From | Event | To | Effects |
|---|---|---|---|
| idle | INIT | idle | 1 effect |
| idle | CHECK | detecting | 2 effects |
| detecting | COLLISION_DETECTED | detecting | 3 effects |
| detecting | CLEAR | idle | 3 effects |
| detecting | INIT | detecting | 1 effect |