cocos_add_directional_light
Add a directional light source to a Cocos Creator scene to simulate sunlight or moonlight, with configurable color, intensity, and shadow settings for realistic lighting.
Instructions
Attach cc.DirectionalLight — sun/moon parallel light.
illuminance is in lux (default 65000 ≈ midday sun).
shadow_pcf: 0=HARD, 1=SOFT, 2=SOFT_2X, 3=SOFT_4X.
A scene typically has exactly one directional light.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"scene_path": "<scene_path>",
"node_id": "<node_id>"
},
"name": "cocos_add_directional_light"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scene_path | Yes | ||
| node_id | Yes | ||
| color_r | No | ||
| color_g | No | ||
| color_b | No | ||
| color_a | No | ||
| illuminance | No | ||
| use_color_temperature | No | ||
| color_temperature | No | ||
| shadow_enabled | No | ||
| shadow_pcf | No | ||
| shadow_distance | No | ||
| csm_level | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |