Description
The Cookie
property of the SpotLight
class represents a texture that is projected by the spotlight. This texture, often referred to as a "cookie," can be used to create patterns or shapes in the light emitted by the spotlight, adding more complex lighting effects to a scene.
Usage
To use the Cookie
property, assign a Texture
object to it. This texture will then be used by the spotlight to project the specified pattern or shape. Ensure that the texture is properly loaded and accessible within the scene.
Example
// Create a new SpotLight instance
SpotLight spotLight = new SpotLight();
// Load a texture to use as a cookie
Texture cookieTexture = Texture.Load("path/to/texture.png");
// Assign the texture to the Cookie property
spotLight.Cookie = cookieTexture;
// Now the spotlight will project the pattern defined by the cookie texture