cocos_add_polygon_collider2d
Add polygon-shaped collision detection to game objects in Cocos Creator for physics interactions, using vertex coordinates to define custom shapes.
Instructions
Attach cc.PolygonCollider2D. points is [[x,y],...] vertex list.
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_polygon_collider2d"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scene_path | Yes | ||
| node_id | Yes | ||
| points | No | ||
| density | No | ||
| friction | No | ||
| restitution | No | ||
| is_sensor | No | ||
| tag | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |