SushiEngine::Simulation::IEntityBehavior
on_update
Message: the engine calls this function.
virtual void on_update(IWorldEditor &world, EntityId id, const TickContext &context)Parameters
| Name | Type | Description |
|---|---|---|
world | IWorldEditor & | The world editor, the only surface a behavior mutates through. |
id | EntityId | This instance's own entity. |
context | const TickContext & | This tick's input, duration, index and driven entity; do not store it. |
Description
Runs once per fixed step while playing, on each hierarchy-enabled entity.
Example
void on_update(SushiEngine::Simulation::IWorldEditor& world,
SushiEngine::Simulation::EntityId id,
const SushiEngine::Simulation::TickContext& context) override
{
if (id != context.driven_entity)
return;
SushiEngine::Simulation::EntityTransform transform = world.transform(id);
transform.position.z += 5.0 * context.delta_seconds;
world.set_transform(id, transform);
}

