3DCharacterCam is a universal 3D camera behavior for Construct 3, designed to
seamlessly handle First-Person (FPS) and Third-Person (TPS) perspectives. It
automatically manages a spring-arm camera, handles wall collisions, and provides
built-in interaction raycasting and smart aim lock-on mechanics.
Setup
Simply add this behavior to your player object (or a dummy pivot object). The
behavior will automatically find the 3D Camera object in your project and take
control of it.
Key Properties & Performance Tips
- Max Cam Distance & Shoulder Offset: These two values define your camera
view.
- For FPS: Set Distance and Shoulder Offset to 0.
- For TPS: Set Max Distance to something like 150 and Shoulder Offset
to 80.
- Tip: You can smoothly transition between aims (e.g., aiming down sights)
using the SetCurrentShoulder and SetMaxCamDist actions combined with
Construct's lerp() expression.
- Solid Tag (Important for Performance): The spring-arm prevents the camera
from clipping through walls by casting rays. If left empty, it will check
against all objects in the layout, which is bad for performance. Give your
wall/floor objects a specific tag (e.g., "Solid") and enter it here. The
camera will only calculate collisions against these objects, safely ignoring
bullets, trigger zones, and particles.
- Arm Recovery Speed: Controls how quickly the camera returns to its maximum
distance after no longer colliding with a wall. A low value (e.g., 2) gives
a slow, cinematic drift back, while a higher value (e.g., 10 to 50) provides
a snappy, near-instant recovery.
- Player Z (Eye Height): The vertical offset of the camera from the object's
origin. You can easily animate this property in the event sheet to create
head-bobbing or crouching effects.
Controls & Actions
- Mouse Look: Call the MoveCamera(deltaX, deltaY) action and pass your mouse
movement (e.g., Mouse.MovementX and Mouse.MovementY). The behavior
automatically multiplies this by your Sensitivity and clamps the pitch
between -89° and 89° so the camera never flips upside down.
- Raycasting: Use the CastInteractRay action to shoot a ray exactly from the
center of the screen. If it hits an object with your Solid Tag, it fires the
On Ray Hit trigger.
- Inside the trigger, you can access the exact 3D world coordinates (HitX,
HitY, HitZ) and the hit object's UID (TargetItemUID).
- Tip: You can pass a string tag into the action (like "shoot" or
"interact") to easily separate your weapon hits from interacting with
doors in the event sheet!
- Aim Lock-on: Use the SetAimLockTarget action to smoothly pull the camera
toward an enemy's UID.
- If Force Center is True, the camera will aggressively lock exactly onto
the target.
- If Force Center is False, it enables a "Soft Lock". The camera will only
correct itself if the target tries to leave the safe zone of the screen
(±35° horizontal, ±15° vertical), giving the player freedom to manually
aim while keeping the enemy in frame.