Skip to main content
Glama

cocos_scaffold_camera_follow

Generate a camera follow script for Cocos Creator that tracks targets with deadzone smoothing and optional world bounds, ensuring frame-rate-independent movement.

Instructions

Generate CameraFollow.ts — attach to the Camera node to track a target with deadzone + frame-rate-independent smoothing + optional world bounds.

@property target (Node) — typically the Player. @property offsetX/offsetY/fixedZ — fixed camera offset; fixedZ == -1 means "follow target's z" (sentinel since 0 is a legitimate z value and Cocos Inspector has no null-number). @property smoothing — 0 = instant snap, 1 = very slow lerp. Uses 1 - Math.pow(smoothing, dt) so feel is identical at 30 vs 60 vs 120 fps. @property deadzoneWidth/Height — camera only moves when target leaves this centered rect; kills idle-state jitter. @property useWorldBounds + worldBoundsMin/MaxX/Y — optional clamp.

Zero per-frame allocation (reuses private _tmp + _desired Vec3s); null-checks target each lateUpdate (target may be destroyed mid- scene).

Returns {path, rel_path, uuid_standard, uuid_compressed}.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathYes
rel_pathNoCameraFollow.ts
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden and excels by disclosing key behavioral traits: it generates a file with specific properties (e.g., target tracking, smoothing logic), mentions performance details ('Zero per-frame allocation'), handles edge cases ('null-checks target each lateUpdate'), and describes the return format. This goes beyond basic functionality to include implementation nuances.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and front-loaded with the main purpose, followed by property details and behavioral notes. It is appropriately sized with no wasted sentences, though it could be slightly more concise by integrating some details more tightly. Every sentence adds value, such as explaining smoothing logic and memory usage.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of generating a camera-follow script with multiple behavioral aspects, no annotations, and no output schema, the description is largely complete: it covers purpose, properties, performance, edge cases, and return values. However, it lacks information on the input parameters, which is a minor gap in an otherwise thorough explanation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 2 parameters with 0% description coverage, and the tool description does not mention or explain these parameters at all. While the description details the generated script's properties (e.g., target, offsetX), it fails to add meaning to the actual input parameters (project_path, rel_path), leaving them undocumented and unclear in context.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Generate CameraFollow.ts — attach to the Camera node to track a target with deadzone + frame-rate-independent smoothing + optional world bounds.' It specifies the verb ('Generate'), resource ('CameraFollow.ts'), and distinguishes from siblings by focusing on camera-follow functionality, unlike other scaffold tools for audio controllers, enemy AI, etc.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool: 'attach to the Camera node to track a target.' It implies usage for camera tracking in game development. However, it does not explicitly state when not to use it or name alternatives among siblings, such as other camera-related tools like 'cocos_add_camera'.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/chenShengBiao/cocos-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server