I’m not sure how to even ask this question. I have been working on it all day and reading forums scripting reference pages and answers on this site but I’m just not understanding.
I need to set the camera to only look at a certain layer culling mask based on a gameObject selection.
Something like this:
public var LayerName
//Make the code reusable when attached to different objects
//by changing the visible layer in the inspector
if(Input.GetMouseButton(1))//mouse over and left click a collider object
{
Camera.mySecondCam.cullingMask = LayerName;
//Make the second cameras culling mask change to a preset layer name or number.
}
The above code is not functional and is listed only for aid in explaining the end goal.
So I may need ray casting and I need to know what to code in the “layer name or number” section. I have looked into camera target swapping and using multiple cameras turning them off and on like light switches when parts of the main gameObject are selected. (each part has its own collider)
I have an object visible in the main camera and I have a second camera acting as a picture-in-picture view of selected object parts. The second camera is based on the MouseOrbitZoom camera found on the Unify Community Wiki. When parts of the main camera object are selected the second camera displays a close up copy (prefab) of the selected object.
For example if I had a car in the main cam I could select the door (layer 1 for example) and the second camera’s culling mask layer should be set to that objects prefab layer (layer2) then I select the main cameras tire (Still layer 1) and the second camera needs to change to that objects prefab (Layer 3 for example)
I am not moving the camera so each object has a double that is set in a base location with the second camera targeted to view and rotate around any of the visible objects (Door or tire in this example). So long as I can change the culling mask layer based on different objects selected I should be able to accomplish my goal.
I hope that’s clear enough to explain my issue. If it is not please feel free to ask for clarification.
Thanks in advance for any help.