book_4_sparkGenerated
code_blocksInput

Description

The ViewModel field is a member of the SceneRenderLayer enumeration in the Sandbox namespace. This layer is specifically designed to be drawn on top of all other layers, with an altered depth. It is typically used for rendering view models, such as weapon models in first-person games, ensuring they appear above the rest of the scene.

Usage

To use the ViewModel layer, assign it to the RenderLayer property of a SceneObject or Component that you want to render on this layer. This will ensure that the object is drawn on top of other scene elements, with the appropriate depth adjustments.

Example

// Example of setting a SceneObject to render on the ViewModel layer
SceneObject myWeaponModel = new SceneObject();
myWeaponModel.RenderLayer = SceneRenderLayer.ViewModel;

// This ensures the weapon model is rendered on top of other scene elements
// with the necessary depth adjustments for a first-person view.