godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.67k stars 20.11k forks source link

Multi camera 3d setup doesn't update collision shapes translation properly #52345

Open lofihung opened 3 years ago

lofihung commented 3 years ago

Godot version

3.3.3 stable

System information

windows 10, gles3, intel hd 520

Issue description

when instancing a two viewport + camera with different cull layers to display different objects at the same time in the same screen space, the second camera updates object's translation but if the object have a collision shape this won't be updated.

As far as I can see the collision shape translation is asigned always to the first camera translation.

having a two camera setup is handy in shmup genre with one orthographic static camera rendering entities and one perspective dynamic camera rendering stage objects.

Steps to reproduce

.node

..kinematicbody ...meshinstance (visual instance 1) ...collisionshape

..kinematicbody2 ...meshinstance (visual instance 2) ...collisionshape

.viewportcontainer ..viewport ...camera (cull 1)

viewportcontainer2 ..viewport ...camera (cull 2)

Minimal reproduction project

in the proyect I've added an animation player moving the second camera translation, might need to check visible collision shapes in debug menu

MultiCamSetup.zip

pouleyKetchoupp commented 3 years ago

We could add an option in CollisionShape3D to set a cull mask for the debug shape (in 4.0 we'll probably have other debug options anyway like custom color).

lofihung commented 3 years ago

you guys are the magicians, anything that helps solve problems easier always get handy, but dont forget the bug before adding new features