I have a node which looks like this tree:

FPSController (Root node, and it's KinematicBody) - CollisionShape - Camera - GroundCheckRayCast

When I moved CollisionShape's location down, camera also going down together. There's no code that change Camera's translation, but why this kind of thing happens?

Another weird thing is that y position of Camera won't changed even it's clearly moved down.

Is this some kind of bug or something? Why Camera's y position was changed, also not updated it's own y position value?

If you are moving the CollisionShape node, the other nodes should not be effected so long as they are not children of the CollisionShape node. In Godot, moving one node should not effected the other sibling nodes.

Does the GroundCheckRayCast node move when you move the CollisionShape node? If the GroundCheckRayCast node moves when you move the CollisionShape node, then I would guess that the FPSController node is moving rather than the CollisionShape node.

If possible, can you share the code and/or project? I'm guessing something in the code is causing the issues you are experiencing. (Side note: Welcome to the forums!)

Great, thanks! I'll take a look and see if I can figure out what is going on.

I think I found the issue and why the camera is moving. The camera is moving when the collision shape moves because the collision shape enters the ground, causing the entire KinematicBody node to be moved upwards when the player moves while crouching. I believe this is what is causing the issues you are experiencing.

Here is a GIF showing what is going on, where the green sphere is the position of the camera, and the red cube is the position of the floor when the player is not crouching:

There are several ways you can go about fixing this. Changing the size of the capsule CollisionShape node that is used for the player is one way, but personally I think of the easiest and most flexible ways is to have multiple CollisionShape nodes that you enable and disable as needed.

I made the changes to the project to use multiple CollisionShape nodes and now the camera does not move with the collision shape. I have uploaded the project to my Google Drive if you want to see the changes I made. Hopefully this helps!

@TwistedTwigleg

Thanks! Seems like you are right, since using two different collision shape and just switch, now my camera won't move anymore!

However in my Godot editor, I can't run the project in editor like Unity, but seems like you are playing in Godot editor. Could I ask how did you do that? Because recently I searched about that and all they said it's not possible yet in Godot.

Also when I disabled all collision shapes in KinematicBody(FPSController), it still collide with objects such as walls. Is kinematic body do automatically some collision stuff? So if there is any collision shape inside of children, using instead? Reason I asking this because I make a some kind of tunnel entrance, so that crouching function works. I set the tunnel's ceiling is lower than stand collision shape, but still my controller passing through.

@modernator said: @TwistedTwigleg

Thanks! Seems like you are right, since using two different collision shape and just switch, now my camera won't move anymore!

Awesome!

However in my Godot editor, I can't run the project in editor like Unity, but seems like you are playing in Godot editor. Could I ask how did you do that? Because recently I searched about that and all they said it's not possible yet in Godot.

I was not running the game in the editor. Instead I had collision shapes in the game visible. You can enable/disable collision shapes being visible within the game by clicking the Debug menu in the top left corner of the Godot editor and checking a box that says something like visual collision shapes.

Also when I disabled all collision shapes in KinematicBody(FPSController), it still collide with objects such as walls. Is kinematic body do automatically some collision stuff? So if there is any collision shape inside of children, using instead? Reason I asking this because I make a some kind of tunnel entrance, so that crouching function works. I set the tunnel's ceiling is lower than stand collision shape, but still my controller passing through.

The collision shape still colliding with walls is likely due to the code enabling the collision shapes. You'd need to make a Boolean or something else within the code that stops the code from enabling the collision shapes.

I'm not sure on why the tunnel ceiling is not colliding though. It should work so long as the collision shape of the ceiling is lower than the highest point on the collision shape you are wanting to use. Does the ceiling have a StaticBody, RigidBody, or KinematicBody node with a CollisionShape setup?

@TwistedTwigleg Aha! I just figured out, because I just duplicated stand collision shape, crouch collision shape had same Capsule Shape. Clear the capsule shape in crouch collision shape and create new one, now it works! Thank you so much!

3 years later