0 votes

I have a split screen RTS game. I play different sprite animations for selected and not selected units. But when I select the unit, I see selected animations for this unit on both screens.
Is it possible to show selected animations only for one camera and not selected for the others?

in Engine by (274 points)

1 Answer

0 votes

i'm not sure you can, the sprite is an object of the world, if you have 2 cameras looking at the same world, they'll see the same thing.

In 3D there is a cull mask property for the camera, and every mesh has a layer property: the camera will only render the mesh in the same render layer of its cull layer.
I cant find the same option for the camera 2D, i dont know why (although the project setting menu has both the 2D and 3D render layer name window, so i think somehow is possible to set the cull mask for the 2D camera as well)

if you can manage to find it, you simply need to place 2 sprites on 2 different render layer, and assign each camera to each layer. You can now control them separately

EDIT: i checked and confirm that cull mask is not present in 2D. I thought it was possible to emulate the effect with light mask, but the same issue is present, camera2D has no way to render light layers selectively

by (1,514 points)
edited by

Is it possible to do by the shader material?

i wouldnt know how, the problem is not the material/sprite itself, but the camera, since i dont know a way to tell a specific camera what to see and what to exclude.
said so, it seems strange this feature is present on 3D but not 2D, i would maybe post a question on the github (if nobody else answer here)

here a similar post that was easier to solve (cause the camera was 3D)


Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.