Components:
PhysicsCharacterController - Character movement
CameraController - Third/first person camera
MechGrapple - Grappling hook system
References:
Rigidbody (rb): Character's Rigidbody component
Extra Swing Body: Optional second Rigidbody for more rigidity when swinging
Aim Camera: Camera used for aiming
Rope Start: Transform where rope visually starts
Rope Line: LineRenderer for rope visuals
Grapple Settings:
Grapple Mask: Layers the hook can attach to (set to "Ground" layer)
Max Grapple Distance : Maximum reach distance
Pull Acceleration : Force applied when pulling
Stop Distance : Auto-detach when this close to target
Max Grapple Time : Safety timeout in seconds
Rope Visual Settings:
Rope Segments : Number of rope segments for visuals
Rope Sag Amount : How much rope droops in middle
Rope Wave Strength : Wobble animation intensity
Rope Wave Speed : Wobble animation speed
Rope Extend Speed : How fast rope extends when fired
Rope Retract Speed : How fast rope retracts when released
Physics Interaction:
Spring Joint settings are for non kinematic rigidbodies only
Use Spring Joint (true): Enable spring joint for Rigidbody targets like a non kinematic rigid body that you can throw around
Joint Spring : Spring strength (higher = stiffer)
Joint Damper : Spring damping (higher = less bouncy)
Joint Max Distance Factor : Max rope length multiplier
Joint Min Distance Factor : Min rope length multiplier
Input:
Grapple Action: Toggle grapple on/off (Left Mouse Button)
Pull Action: Pull towards grapple point (Right Mouse button)
Hold To Pull (true): If true, hold to pull; if false, release to pull
Debug State:
Is Grappling: Shows current grappling state (read-only)
Is Pulling: Shows current pulling state (read-only)
Grappling Rigidbody Targets
Creates SpringJoint between character and target
Both bodies react to forces (realistic physics)
Rope acts like elastic spring
Can swing around dynamic objects
Grappling Static Surfaces
No joint created (static object can't move)
Blocks outward velocity only (prevents moving away)
Allows movement toward target and around it
Feels natural, not pole-like
Pull Mechanic
Hold To Pull = true: Hold Pull button to pull toward target
Hold To Pull = false: Release Pull button to pull (hold to cancel)
Applies acceleration along rope direction
Releasing pull sets new swing length
Rope Visuals
Animated extension when grapple fires
Sag effect for realistic drooping
Wobble animation for dynamic feel
Smooth retraction when released
LineRenderer updates every frame
Rigidbody on character
Camera for aiming
LineRenderer for rope visuals (optional)
Ground layer for grapplable surfaces
IsGrappling (bool): Check if currently grappling
isGrappling (bool): Same as above (field version)
isPulling (bool): Check if currently pulling
Movement:
Move Speed : Ground movement speed
Rotation Speed : Character rotation speed
Ground Friction : Stopping friction (higher = faster stop)
Grapple Air Control Force : Steering strength while grappling
Rotate With Camera : Character faces camera direction
References:
Camera Transform: Main camera (auto-finds if empty)
Grapple Script: MechGrapple component (auto-finds if empty)
Move Action: WASD/analog stick input
Normal: Velocity-based movement, camera-relative controls
Grappling: Force-based movement, no friction, preserves momentum
Rigidbody
Collider
Camera Positions:
First Person Offset (0, 1, 0): Eye level position
Third Person Offset (0, 2, -5): Behind character position
Transition Speed (10): View switch speed
Mouse:
Mouse Sensitivity (2): Look speed
Min Vertical Angle (-60): Look down limit
Max Vertical Angle (80): Look up limit
Crosshair:
Show Crosshair (true): Display center dot
Crosshair Size (4): Dot size in pixels
Crosshair Color (White): Dot color
References:
Target: Character transform to follow
Look Action: Mouse/right stick input
Toggle View Action: Switch first/third person
Mouse: Look around
E: Toggle first/third person
ESC: Unlock cursor
Left Click: Re-lock cursor
Target character with Transform
Create Input Actions asset with:
Move (Value, Vector2):
2D Vector Composite: W/A/S/D keys
Optional: Left Stick [Gamepad]
Look (Value, Vector2):
Mouse Delta [Mouse]
Optional: Right Stick [Gamepad]
ToggleView (Button):
E [Keyboard]
Grapple (Button):
Right Mouse Button
Pull (Button):
Left Mouse Button
Create character GameObject with Capsule/model
Add Rigidbody
Add Capsule Collider
Add PhysicsCharacterController script
Assign Input Actions to both scripts
Create empty GameObject for camera
Add CameraController script
Assign character as Target
Assign Look and ToggleView actions
In MechGrapple:
Assign Rigidbody
Assign Camera
Set Rope Start transform
Create "Ground" layer
Set Grapple Mask to "Ground"
Assign ground objects to Ground layer
Character faces camera direction
W = Forward (camera-relative)
No friction while grappling
Force-based steering during grapple
Third person by default
E to toggle first person
Crosshair for aiming
Cursor locks automatically
Scripts communicate automatically
PhysicsCharacterController checks MechGrapple.IsGrappling
Character preserves swing momentum
Air control works during grapple
No friction applied while grappling
Force-based movement doesn't interfere with spring joint
Character won't move:
Assign Move Action in Inspector
Check Rigidbody isn't kinematic
Camera won't look:
Assign Look Action in Inspector
Verify cursor is locked
Grapple doesn't work:
Check Grapple Mask includes ground layer
Verify ground objects have Ground layer
Assign Grapple Action in MechGrapple
Check Max Grapple Distance is large enough
Verify Aim Camera is assigned
Rope doesn't show:
Assign LineRenderer to Rope Line field
Check LineRenderer is enabled on GameObject
Verify Rope Start transform is assigned
Grapple feels too stiff/bouncy for attacking to objects:
Adjust Joint Spring (lower = softer)
Adjust Joint Damper (higher = less bounce)
Tweak Joint Max/Min Distance Factors
Character slides while grappling:
This is normal - friction disabled for swinging
Character Falls when Hooked:
Add all of the rigid bodies on the player in the grapple script.