Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
daishishi opened this issue Jun 2, 2024 · 9 comments
Closed

Comments

@daishishi
Copy link

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
Copy link
Author

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.

  • Setting a PCam3D to any follow mode and giving it a target will snap it to the World origin.
  • Trying the clear button in the follow target button on the Inspector does nothing.
    • Deleting the target 3D Node makes the Inspector button go back to its "clear" state. The PCam3D continues locked to the world origin
  • The only work around is to create a brand new PCam3D node and position it in the world.

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
Copy link
Owner

ramokz commented Jun 2, 2024

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
Copy link
Author

daishishi commented Jun 2, 2024

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. 🥴
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
Copy link
Owner

ramokz commented Jun 2, 2024

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.

@ramokz ramokz closed this as not planned Won't fix, can't repro, duplicate, stale Jun 2, 2024
@daishishi
Copy link
Author

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.

  • Create the basic PCam3D setup
  • Set the follow mode to any you want, like simple
  • Move your target around. Everything works OK
  • Set the follow mode to None
  • Your PCam3D snaps to the world origin
  • You can't move the camera around anymore. It got stuck at World Origin

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

@ramokz
Copy link
Owner

ramokz commented Jun 2, 2024

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
Copy link
Author

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
Copy link
Owner

ramokz commented Jun 2, 2024

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

@ramokz
Copy link
Owner

ramokz commented Jun 2, 2024

Thanks for reporting this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants