Core & Components
The core code is designed to remain untouched and unexpanded.
Its members are first-class citizens of the asset and must have no
knowledge of the behaviour components.
These are the three core members and their responsibilities:
Prop
Owns the
RigidBody3Dtarget body and holds a reference to the activeInteractor, acting as the central hub between physics, input and behaviour.Dispatches interaction lifecycle events (start, end) and camera movement requests as signals, decoupling core logic from behaviour implementation.
Interactor
Casts a ray each physics frame, either from the screen center (
CAMERA_MODE) or from the cursor position (CURSOR_MODE), to detect and bindPropnodes within reach.Tracks and exposes input state (pressed, just_pressed, released) and mouse delta for consumption by behaviour components via
get_action_state()andget_mouse_delta().
PropBehaviour
Defines the base interface for all behaviour components, exposing a reference to the owning
Propand its activeCamera3Dthrough thesetup()method.Declares the
execute()method as the single entry point called each frame byProp.update_interaction(), to be overridden by each concrete behaviour.
The components code is considered “second-class”, inheriting from
PropBehaviour and meant to be modified, expanded and/or replaced.
Behaviour components can (and should) know about the internals of core
members, but not the other way around.
Currently there are three implementations of behaviour components, though more may be added in the future:
GrabBehaviour
SpinBehaviour
ThrowBehaviour