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

While in Third Person mode the Offset and SpringArm don't update on editor #318

Closed daishishi closed 4 months ago

daishishi commented 4 months ago

Issue description

Hello,

I don't know if this is intended, but I can't see why it would. So I'm opening a issue here.

While in the editor (and in the Phantom Camera preview tab), when using the follow mode 'Third Person' the PhantomCamera3D get stuck at the origin. However, when you run the scene the camera goes to where you set in the Camera Offset and Spring Arm distance.

It is annoying and really frustrating trying to set up the third person camera when you don't have a live feedback of its view.

Steps to reproduce

Make a simple scene with a standard PhatomCamera3D setup. Add a MeshInstance3D (or other object) and set the PCam3D to follow mode Third Person, following your new object. The camera position and rotation are not updated in the editor. The position and rotation is updated "in game".

(Optional) Minimal reproduction project

No response

daishishi commented 4 months ago

After some digging I discovered the problem is more general than I thought, and in multiples ways too. Here some bullet points of some situations that result in the same problem.

I don't know if is better to create a new issue with this more general behavior, or add to this one. Either way I can't see this a intended way of the Phantom Camera Addon working.

This is particular annoying because I tried to change a Third Person Camera to a Static (with look at) Camera.

ramokz commented 4 months ago

While in the editor (and in the Phantom Camera preview tab), when using the follow mode 'Third Person' the PhantomCamera3D get stuck at the origin. However, when you run the scene the camera goes to where you set in the Camera Offset and Spring Arm distance.

That is a regression from the 0.7.1 release. Should be resolved in 0.7.2.

A quick fix is to update this on line 699 inside the PhantomCamera3D:

global_position = _get_position_offset_distance()
## To
follow_position = _get_position_offset_distance()

Setting a PCam3D to any follow mode and giving it a target will snap it to the World origin.

Haven't been able to replicate this, so am entirely sure how this happens? It should just jump to the follow target's position by default.

Trying the clear button in the follow target button on the Inspector does nothing.

Can confirm this as a regression in 0.7.1, has been solved in 0.7.2 as well.

This is particular annoying because I tried to change a Third Person Camera to a Static (with look at) Camera.

Do you mean you want to change the follow_mode? If so, then that is intentionally made not possible.

daishishi commented 4 months ago

Thanks for the fast response, clearing that are regressions and pointing to a workaround.

Setting a PCam3D to any follow mode and giving it a target will snap it to the World origin.

I got so tunnel vision that I didn't test moving the follow target, or giving a target that weren't in the World Origin. :woozy_face: So no problem here.

Do you mean you want to change the follow_mode? If so, then that is intentionally made not possible.

Yes, I had a Camera with follow mode = Third Person, and tried to changed to follow mode = None. Then I tried to change its position inside the world. But if this is not possible, and I have to create a new camera then its OK. I just didn't find where this is the intended behavior. If I understood correctly after a camera is given a follow mode, it can't revert back to none follow mode, and thus you can't placed freely in the game world.

I think you can close this issue. Thank you again.

ramokz commented 4 months ago

I just didn't find where this is the intended behavior. If I understood correctly after a camera is given a follow mode, it can't revert back to none follow mode, and thus you can't placed freely in the game world.

Correct, you cannot change the follow mode at runtime. Though you can clear the follow target during runtime, which would effectively disable any follow logic. Third Person follow is the one follow mode where that becomes slightly complicated, as you would need to move the SpringArm3D that has the PCam3D attached to it to control the position.

Haven't tried myself, but if you're just looking to rotate it, while it has no follow target, then that should be possible.

daishishi commented 4 months ago

I just test something and I'm not sure if it is a problem. Here the steps to reproduce.

While in the editor, not necessary to run your scene.

Is this a result of the code behind the "clear button" in the inspector not working?

ramokz commented 4 months ago

That's a new one that I hadn't seen before, but you're right.

Does adding this code block to the setter in follow_mode property declaration on line 150, inside PhantomCamera3D, resolve it for you?


#### This block
if follow_mode == FollowMode.NONE:
  _should_follow = false
elif follow_mode == FollowMode.GROUP and follow_targets or follow_target:
  _should_follow = true
####

notify_property_list_changed()
daishishi commented 4 months ago

I just added this code and it resolved the problem. I didn't remove any other code, just added this block. Here how it looked: Captura de tela de 2024-06-02 16-02-43

Addendum: My camera was already on follow mode = none (and stuck at origin) when I added this block of code. I had to set to another follow mode and then to None, then it worked.

Thanks.

ramokz commented 4 months ago

Nice, I'll add this to the 0.7.2 release. Should be out in the coming days.

ramokz commented 4 months ago

Thanks for reporting this!