@rbxts/cmove-wrapper - v1.0.0
    Preparing search index...

    Class CMover

    A sophisticated camera controller that provides smooth camera movement, rotation, and occlusion handling. Manages camera positioning with configurable smoothing, target tracking, and intelligent obstacle avoidance.

    Index

    Constructors

    • Constructs a new CMover instance that takes control of the specified camera with smooth movement and optional occlusion detection. Automatically binds to RenderStep and sets up occlusion checking if enabled.

      Parameters

      • camera: Camera

        The camera instance to control

      • occlusionChecking: boolean = false

        Whether to enable occlusion detection system

      • OptionalfilterCallback: (newPosition: Vector3, newRotation: CFrame) => LuaTuple<[Vector3, CFrame]>

        Optional callback to filter position and rotation before applying to camera

      Returns CMover

      • CMover._step
      • CMover._occlusionCheck

    Properties

    Active: boolean = false

    Enables or disables the camera movement system. When false, the camera will not update its position or rotation.

    CMover._step

    Destroyed: Signal<void> = ...

    Fires when Destroy() is called, or when the target Camera is destroyed.

    Instance: Camera

    The camera instance being controlled by this CMover.

    LookTargetDeferredOcclusionChanged: Signal<
        [currOcState: boolean, prevOcState: boolean],
    > = ...

    Fires when the look target has been occluded or unoccluded for more than 250 milliseconds, providing debounced state changes.

    LookTargetOccluded: boolean = false

    Indicates whether the look target is currently occluded by an object. Updates immediately when occlusion state changes.

    LookTargetOccludedDeferred: boolean = false

    Indicates whether the look target has been occluded for more than 250 milliseconds, providing a debounced occlusion state.

    LookTargetOcclusionChanged: Signal<[currOcState: boolean, prevOcState: boolean]> = ...

    Fires immediately when the look target's occlusion state changes, providing both current and previous states.

    MoveTargetDeferredOcclusionChanged: Signal<
        [currOcState: boolean, prevOcState: boolean],
    > = ...

    Fires when the move target has been occluded or unoccluded for more than 250 milliseconds, providing debounced state changes.

    MoveTargetOccluded: boolean = false

    Indicates whether the move target is currently occluded by an object. Updates immediately when occlusion state changes.

    MoveTargetOccludedDeferred: boolean = false

    Indicates whether the move target has been occluded for more than 250 milliseconds, providing a debounced occlusion state.

    MoveTargetOcclusionChanged: Signal<[currOcState: boolean, prevOcState: boolean]> = ...

    Fires immediately when the move target's occlusion state changes, providing both current and previous states.

    OcclusionCheckActive: boolean = false

    Enables or disables occlusion detection. When true, the system checks for objects between the camera and its targets.

    CMover._occlusionCheck

    OcclusionReaction: OcclusionReaction = CMoveWrapper.OcclusionReaction.None

    Defines how the camera should react when occlusion is detected, such as passing through or avoiding obstacles.

    PositionMode: ActiveMode = CMoveWrapper.ActiveMode.Lock

    Controls how the camera's position follows its target - either locked to a specific position or following within a radius.

    PositionSmoothing: number = 0.5

    Time constant for position smoothing in seconds. Lower values create snappier movement, higher values create smoother transitions. Set to 0 or negative for instant positioning.

    CMover._step

    RotationMode: ActiveMode = CMoveWrapper.ActiveMode.Lock

    Controls how the camera's rotation follows its target - either locked to look at a specific point or following a target.

    RotationSmoothing: number = 0.5

    Time constant for rotation smoothing in seconds. Lower values create snappier rotation, higher values create smoother turns. Set to 0 or negative for instant rotation.

    CMover._step

    Methods

    • Completely cleans up and destroys this CMover instance, unbinding from RenderStep and disconnecting all connections. After calling this method, the CMover will no longer affect the camera and all signals will be destroyed.

      Returns void

    • Makes the camera follow a BasePart while maintaining a maximum distance, creating a dynamic follow behavior. The camera stays within the specified radius and only moves when the target exceeds that distance.

      Parameters

      • target: BasePart

        The BasePart to follow

      • maxDistance: number

        The maximum distance the camera can be from the target before it starts moving

      Returns void

    • Directs the camera to continuously look at a target, either a specific world position or a moving BasePart. The camera's rotation will smoothly track the target while position remains controlled independently.

      Parameters

      • target: BasePart | Vector3

        The position or BasePart to look at

      Returns void

    • Moves the camera to match a specific CFrame, locking both position and rotation to the target's position and look direction. Sets both PositionMode and RotationMode to Lock, making the camera precisely follow the given CFrame.

      Parameters

      • target: CFrame

        The CFrame defining where the camera should move and what direction it should face

      Returns void

    • Moves the camera to a specific world position while keeping the current rotation target unchanged. Only affects position - the camera's look direction remains controlled by the previous look target.

      Parameters

      • target: Vector3

        The 3D position where the camera should move

      Returns void

    • Locks the camera to move with a BasePart, matching both its position and orientation as it moves through the world. The camera will follow the part's position and look in the direction the part is facing.

      Parameters

      • target: BasePart

        The BasePart to track and move with

      Returns void

    • Configures the raycast parameters used for occlusion detection, allowing you to specify which objects to ignore when checking for obstacles. Can be applied to move target, look target, or both simultaneously.

      Parameters

      • ignoreTarget: OcclusionIgnoreTarget

        Specifies which target's occlusion parameters to configure

      • filterDescendants: Instance[]

        Array of instances whose descendants should be ignored in occlusion raycasts

      • ignoreWater: boolean = false

        Whether to ignore water terrain when detecting occlusion

      • prioritiseCanCollide: boolean = false

        Whether to respect CanCollide property when detecting occlusion

      Returns void