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
| Name | Required | Description | Default |
|---|---|---|---|
| project_path | Yes | ||
| rel_path | No | CameraFollow.ts |