GodotVCamera icon indicating copy to clipboard operation
GodotVCamera copied to clipboard

Transition Resource

Open aXu-AP opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe. Currently only linear transition from one VCamera to another is supported. In situations where cameras are orbiting around object this movement feels a bit wrong. More natural way would be moving around that object in circular fashion. IIRC Cinemachine has something similiar.

Another nitpick I have: transition details have to be set in VCameras, no option to set them per VCameraBrain (as many projects need only one type of transition). Code structure wise it also feels weird that transition details are set only in VCamera, but transition is handled by VCameraBrain.

Describe the solution you'd like Transition logic could be moved to separate SpatialTransition resource class with subclasses implementing the actual logic. The interface should include

  • from_spatial doesn't need to be explicitly VCamera, can be any Spatial node.
  • to_spatial
  • start_transition() is called by VCameraBrain at the start of transition
  • get_current_offset() returns float between [0...1] which tells current progress. This offset value is fetched by VCameraBrain each time it wants to update its position, which happens with:
  • get_transform_at(offset : float) this is the meat of any transition class. Returns Transform at specific point in time.
  • signal transition_finished gets emitted when transition has reached end to notify brain to run finishing logic.

Subclasses would include:

  • LinearTransition (current implementation)
  • CylindricalTransition for orbiting behaviour
  • InertiaTransition, which would try to retain speed in natural fashion.
  • BlendTransition we are going all inception with this one. Has 2 different transitions and blends between them.
  • Maybe even try to implement collision aware transition?

VCameraBrain would have default_transition property and VCamera would have override_transition_in and override_transition_out properties. If overrides are set, they will be used instead of brain's default. In case current camera has out transition and next camera has in transition, camera with higher priority wins.

Describe alternatives you've considered Different transitions could be hardcoded into VCameraBrain, but that severely limits their flexibility.

Additional context I believe I have everything figured out, including math required for different transitions. If I get green light, I can implement it.

aXu-AP avatar May 31 '22 20:05 aXu-AP