ramokz / phantom-camera

👻🎥 Control the movement and dynamically tween 2D & 3D cameras. Built for Godot 4. Inspired by Cinemachine.
https://phantom-camera.dev/
MIT License
2.17k stars 71 forks source link

FollowMode.THIRD_PERSON attempts to set `_follow_spring_arm` parameters even if `_follow_spring_arm` is null #257

Closed ZenithStar closed 5 months ago

ZenithStar commented 5 months ago

Issue description

There appears to be a if is_instance_valid(_follow_spring_arm):check in set_spring_length but none of the others setters. They all need this same check.

When _follow_spring_arm is instantiated in _ready(), its parameters need to be initialized.

_follow_spring_arm = SpringArm3D.new()
_follow_spring_arm.spring_length = spring_length
_follow_spring_arm.collision_mask = collision_mask
_follow_spring_arm.shape = shape
_follow_spring_arm.margin = margin
get_parent().add_child.call_deferred(_follow_spring_arm)

Steps to reproduce

Setting any of the spring arm parameters in the editor raises errors and causes a crash when run.

(Optional) Minimal reproduction project

No response