Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ph_hit

ph_hit applies a scripted hit to a physical object when the section activates. Use it for one-shot impacts, breaking props, kicking an object, or driving door and physics reactions through the normal hit API.

The hit is created by PhysicalHitManager during activation. The manager does not wait for actor interaction.

Parameters

power

Type: number. Optional. Default: 0.

Hit power.

impulse

Type: number. Optional. Default: 1000.

Hit impulse.

bone

Type: string. Required. Default: none.

Bone name passed to the hit object.

dir_path

Type: string. Required. Default: none.

Patrol path whose first point defines the hit direction.

The section also supports common switch fields such as on_info and on_timer.

Example

[logic]
active = ph_hit@kick

[ph_hit@kick]
power = 0.5
impulse = 1200
bone = door
dir_path = kick_direction
on_timer = 100 | ph_idle@after_hit

Runtime sequence

  1. SchemePhysicalHit.activate reads common switch conditions and hit fields.
  2. dir_path is resolved as a patrol path, and point 0 is used as the direction target.
  3. The manager builds a hit object with power, impulse, bone, type = hit.strike, and the calculated direction.
  4. The physical object receives the hit through object.hit(...).
  5. Later updates only evaluate common section switching.

Notes

  • bone and dir_path are required. Missing values fail during scheme activation.
  • The hit direction is calculated from the object position toward point 0 of dir_path.
  • The hit type is strike.
  • The hit is applied on activation. Common switches are checked during later updates.
  • Use an on_timer or another common switch when the object should move to an idle section after the impact.