PlayerMovement
ASSIGNABLES
playerCam: The parent GameObject to which the main camera should be attached.
orientation: An object with the same height as the camera, used to rotate the player around the Y-axis for visual orientation.
useSpeedLines: Enables or disables speed line effects that appear when the player reaches a certain speed threshold.
speedLines: A reference to the particle system component that generates the speed line effects.
minSpeedToUseSpeedLines: The minimum speed required for speed lines to be displayed.
speedLinesAmount: Being 1 = default, amount of speed lines displayed.
MOVEMENT
autoRun:Enables automatic running without requiring the player to hold a sprint button.
alternateSprint: Defines the sprint behavior:
True
: Hold to sprint, release to stop sprinting.False
: Press and hold to sprint continuously.
alternateCrouch: Defines the crouch behavior:
True
: Hold to crouch,releaseto uncrouch.False
: Press and hold to crouch continuously.
canRunBackwards: Determines if the player maintains running speed while moving backward:
True
: Running speed applies when moving backward.False
: Walking speed applies when moving backward.
canRunSideways: Determines if the player maintains running speed while moving sideways (strafing):
True
: Running speed applies when strafing.False
: Walking speed applies when strafing.
canRunWhileShooting:Determines if the player maintains running speed while shooting:
True
: Running speed applies while shooting.False
: Walking speed applies while shooting.
loseSpeedDeceleration: The rate at which the player's speed decreases from running to walking
acceleration: The player's ability to gain speed quickly.
runSpeed: The player's running speed
walkSpeed: The player's walking speed
allowCrouch: Enables or disables the player's ability to crouch.
crouchCancelMethod: Defines how the player can exit the crouch state. ( Smooth, FullStop )
crouchSpeed: The player's movement speed while crouching
crouchTransitionSpeed: The speed at which the player transitions into and out of the crouch state
roofCheckDistance: Distance to detect a roof above the head.
maxSpeedAllowed:The maximum speed the player can reach, used to clamp the player's velocity.
whatIsGround: A bitmask representing the layers considered ground. The player can walk on objects within these layers. Check Adding New Surfaces ( Grounds )
groundCheckDistance: The distance from the bottom of the player to check for ground collision.
frictionForceAmount: The amount of force applied to the player's movement to simulate friction.
maxSlopeAngle:The maximum angle (in degrees) of a slope the player can walk on.
STAIRS
maxStepHeight: Maximum allowed height for a step to be considered a climbable step.
maxStepDistance: Maximum Distance to detect a staircase or step.
stepUpHeight: How much the player moves vertically when going upstairs. Too low or high values may cause jittering and not smooth movement.
stepUpSpeed: Speed at which the player moves while on the stairs. Too low values may cause jittering, while too high values may feel like the player is moving too fast.
CAMERA
WARNING: The maximum camera angle is highly recommended to be set to the maximum value, 89.7
maxCameraAngle: The maximum vertical angle (in degrees) allowed for the camera rotation. This limits how far the player can look up or down
WARNING: The Player Sensitivity (Mouse & Controller) values will be overridden if you open the scene from the Main Menu. Check GameSettingsManager.cs for more information.
sensitivityX: Horizontal sensitivity (X Axis)
sensitivityY: Vertical sensitivity (Y Axis)
controllerSensitivityX: Horizontal sensitivity (X Axis) using controllers
controllerSensitivityY: Vertical sensitivity (Y Axis) using controllers
aimingSensitivityMultiplier: Sensitivity will be multiplied by this value when aiming
normalFOV: Default field of view of your camera
runningFOV: Running field of view of your camera
wallrunningFOV: Wallrunning field of view of your camera
fovToAddOnDash: Amount of field of view that will be added to your camera when dashing.
fadeInFOVAmount: Fade Speed - Start Transition for the field of view
fadeOutFOVAmount: Fade Speed - Finish Transition for the field of view
slidingCameraTiltAmount: Rotation of the camera when sliding. The rotation direction is defined by the sign of the value.
cameraTiltTransationSpeed: Speed of the tilt camera movement. This is essentially used for wall running
SLIDING
Enabling this unlocks new customization variables under "CAMERA"
allowSliding: Enables or disables sliding for the player.
slideForce: Forward Force added to the Player on sliding.
slideCounterMovement: The amount of force applied in the opposite direction of the player's movement during a slide
JUMPING
allowJump: Enables or disables the player's ability to jump.
maxJumps: Amount of jumps you can do without touching the ground
resetJumpsOnWallrun: Gains jump amounts when wallrunning.
resetJumpsOnWallBounce: Gains jump amounts when wallrunning.
directionalJumpMethod: Method to apply on jumping when the player is not grounded, related to the directional jump
directionalJumpForce: Force applied on an object in the direction of the directional jump
jumpForce: The higher this value is, the higher you will get to jump.
controlAirborne: How much control you own while you are not grounded. Being 0 = no control of it, 1 = Full control.
allowCrouchWhileJumping: Turn this on to allow the player to crouch while jumping
canJumpWhileCrouching: Allow the player to jump mid-air.
jumpCooldown: Interval between jumping
coyoteJumpTime: Coyote jump allows users to perform more satisfactory and responsive jumps, especially when jumping off surfaces
AIM ASSIST
applyAimAssist: Determine wether to apply aim assist or not.
maximumDistanceToAssistAim: Maximum distance to keep the Aim Assist
aimAssistSpeed: CamerDefine wallrunnable wall layers. By default, this is set to the same as whatIsGround.aOur Slider UI Object. Stamina will be shown here Snapping speed.
aimAssistSensitivity: size of the aim assist range.
STAMINA
usesStamina: You will lose stamina on performing actions when true.
minStaminaRequiredToRun: Minimum stamina required to being able to run again.
maxStamina: Max amount of stamina.
staminaRegenMultiplier: Stamina Regeneration Speed
LoseStaminaWalking: Loses Stamina Walking if true.
staminaLossOnJump: Amount of stamina lost on jumping
staminaLossOnSlide: Amount of stamina lost on sliding.
staminaLossOnDash: Amount of stamina lost on dashing (Introduced in 1.3).
staminaSlider: Our Slider UI Object. Stamina will be shown here
ADVANCED MOVEMENT
WALL RUN
canWallRun: When enabled, it will allow the player to wallrun on walls
whatIsWallRunWall: Define wallrunnable wall layers. By default, this is set to the same as whatIsGround.
useGravity: When enabled, gravity will be applied on the player while wallrunning. If disabled, the player won´t lose height while wallrunning.
wallrunGravityCounterForce: Since we do not want to apply all the gravity force directly to the player, we shall define the force that will counter gravity. This force goes in the opposite direction from gravity.
maxWallRunSpeed: Maximum speed reachable while wall running.
normalWallJumpForce: When wall jumping, force applied on the X axis, relative to the normal of the wall
upwardsWallJumpForce: When wall jumping, force applied on the Y axis.
stopWallRunningImpulse: Impulse applied on the player when wall run is cancelled. This results in a more satisfactory movement. Note that this force goes in the direction of the normal of the wall the player is wall running.
wallMinimumHeight: Minimum height above ground (in units) required to being able to start wall run. Wall run motion will be cancelled for heightsMethod to determine length of wallRun. below this
cancelWallRunMethod: Method to determine length of wallRun.
WALL BOUNCE
canWallBounce: When enabled, it will allow the player to wall bounce on walls.
wallBounceForce: Force applied to the player on wall bouncing. Note that this force is applied on the direction of the reflection of both the player movement and the wall normal.
wallBounceUpwardsForce: Force applied on the player on wall bouncing ( Y axis – Vertical Force ).
oppositeWallDetectionDistance: maximum Distance to detect a wall you can bounce on. This will use the same layer as wall run walls.
DASHING
canDash: When enabled, it will allow the player to perform dashes.
dashMethod: Method to determine how the dash will work
infiniteDashes: When enabled, it will allow the player to perform dashes.
amountOfDashes: maximum ( initial ) amount of dashes. Dashes will be regenerated up to “amountOfDashes”, you won´t be able to gain more dashes than this value, check dash Cooldown.
dashCooldown: Time to regenerate a dash on performing a dash motion
damageProtectionWhileDashing: When enabled, player will not receive damage
dashForce: force applied when dashing. Note that this is a constant force, not an impulse, so it is being applied while the dash lasts
dashDuration: Duration of the ability ( dash ).
canShootWhileDashing: When enabled, it will allow the player to shoot while dashing.
GRAPPLING HOOK
allowGrapple: If true, allows the player to use a customizable grappling hook.
maxGrappleDistance: Maximum distance allowed for the player to begin a grapple action
grappleCooldown: Once the grapple has finished, time to enable it again.
distanceToBreakGrapple: If the distance between the grapple end point is equal or less than this value ( in Unity units ), the grapple will break.
grappleForce: Force applied to the player on grappling.
grappleSpringForce: Spring Force applied to the rope on grappling.
grappleDamper: Damper applied to reduce ropes´ oscillation.
drawDuration: Time that takes the rope to draw from start to end.
ropeResolution: Amount of vertices the rope has. The bigger this value, the better it will look, but the less performant the effect will be.
waveAmplitude: Size of the wave effect on grappling. This effect is based on sine.
waveAmplitudeMitigation: Speed to decrease the wave amplitude over time
CLIMBING LADDERS
canClimb: If true, allows the player to climb Ladders.
maxLadderDetectionDistance: Maximum Distance to detect a Ladder
climbSpeed: Speed to Climb up the Ladder
topReachedUpperForce: On reaching the top, this is the upwards force applied to the Player
topReachedForwardForce: On reaching the top, this is the forward force applied to the Player
allowVerticalLookWhileClimbing: Enable this to allow the Player to move the Camera vertically
hideWeaponWhileClimbing: Hides the Weapon when Climbing
OTHERS
sounds: Player Movement Sounds
grappleSounds: Player Grapple Sounds
footstepVolume: Volume of the AudioSource.
footstepSpeed: Play speed of the footsteps.
footsteps: Footstep clips for all the ground layers
events
Functions | PlayerMovement.cs
RegainDash()
Adds a dash to the dash count of the player.
ResetDashes()
Reset all the dashes to the maximum amount of the dash count of the player.
TeleportPlayer(Vector3 position, Quaternion rotation)
Teleport the player to the specified position and rotation.
position: Vector3 to teleport the player to.
rotation: Rotation for the camera to aim at on teleport.
PlayerMovementEditor.cs can be found as an external script.
Last updated