animate_camera
Create camera animations in Cinema 4D using wiggle, orbit, spline, or linear motion types with customizable positions and keyframes.
Instructions
Create a camera animation.
Args:
animation_type: Type of animation (wiggle, orbit, spline, linear)
camera_name: Optional name of camera to animate
positions: Optional list of [x,y,z] camera positions for keyframes
frames: Optional list of frame numbers for keyframesInput Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| animation_type | Yes | ||
| camera_name | No | ||
| positions | No | ||
| frames | No |
Implementation Reference
- src/cinema4d_mcp/server.py:1001-1066 (handler)The main handler function `animate_camera` that builds the animation command and sends it to Cinema 4D.
async def animate_camera( animation_type: str, camera_name: Optional[str] = None, positions: Optional[List[List[float]]] = None, frames: Optional[List[int]] = None, ctx: Context = None, ) -> str: """ Create a camera animation. Args: animation_type: Type of animation (wiggle, orbit, spline, linear) camera_name: Optional name of camera to animate positions: Optional list of [x,y,z] camera positions for keyframes frames: Optional list of frame numbers for keyframes """ async with c4d_connection_context() as connection: if not connection.connected: return "❌ Not connected to Cinema 4D" # Create command with the animation type command = {"command": "animate_camera", "path_type": animation_type} # Add camera name if provided if camera_name: command["camera_name"] = camera_name # Handle positions and frames if provided if positions: command["positions"] = positions # Generate frames if not provided (starting at 0 with 15 frame intervals) if not frames: frames = [i * 15 for i in range(len(positions))] command["frames"] = frames if animation_type == "orbit": # For orbit animations, we need to generate positions in a circle # if none are provided if not positions: # Create a set of default positions for an orbit animation radius = 200 # Default orbit radius height = 100 # Default height points = 12 # Number of points around the circle orbit_positions = [] orbit_frames = [] # Create positions in a circle for i in range(points): angle = (i / points) * 2 * 3.14159 # Convert to radians x = radius * math.cos(angle) z = radius * math.sin(angle) y = height orbit_positions.append([x, y, z]) orbit_frames.append(i * 10) # 10 frames between positions command["positions"] = orbit_positions command["frames"] = orbit_frames # Send the command to Cinema 4D response = send_to_c4d(connection, command) return format_c4d_response(response, "animate_camera")