Skip to main content
Glama

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 keyframes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
animation_typeYes
camera_nameNo
positionsNo
framesNo

Implementation Reference

  • 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")

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/ttiimmaacc/cinema4d-mcp'

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