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

PhantomCamera3D.set_third_person_rotation() rotates the camera around its own #399

Open
marinho opened this issue Oct 9, 2024 · 0 comments

Comments

@marinho
Copy link

marinho commented Oct 9, 2024

Issue description

For a PCam with follow_mode as ThirdPerson, I wrote this code expecting the camera to rotate around the target (which is the character object), but instead, this method is actually rotating the camera around its own Y.

const SPEED = 5

func _input(event):
	if event is InputEventMouseMotion:
		var x = event.relative.x * 0.001 * SPEED
		var old_rotation = %PCamThirdPerson.get_third_person_rotation()
		var new_rotation = Vector3(
			old_rotation.x,
			old_rotation.y + x,
			old_rotation.z
		)
		%PCamThirdPerson.set_third_person_rotation(new_rotation)

Steps to reproduce

  1. Add a CharacterBody3D, Camera3D, PCamHost and PCam to the scene, plus some ground with respective collisions
  2. Set PCam with:
    a. Priority = 0
    b. Follow Mode = Third Person
    c. Follow Target = CharacterBody3D
    d. Follow Offset = (0, 10, 10)
    e. Spring Length = 10
    f. Create a script and add the code I wrote above
    g. Run

(Optional) Minimal reproduction project

Additionally, if I set Look at Mode to Siple and Look at Target to CharacterBody3D (in face any other object), the camera will as well point to bottom with no clear reason.

Thanks!

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

1 participant