This article will provide some basic examples on how to tweak the player movement so you can customize it to suit your game.
The player jump height is set in the BasicActor lua script: GameSDK\Scripts\Entities\actor\BasicActor.lua
On Line 176 you'll see:
jumpHeight = 1.5, -- In meters
When changing the jump height it's important to note that the player will start to take fall damage after a certain height.
You can tweak these values via the various pl_health.fallDamage_ CVars to give you full control over speeds and damages.
There are several CVars which can give (or take) control while the player is in the air.
CVar | Description | Default Value |
---|---|---|
pl_jump_control.air_control_scale | Scales base air control while in the air. Set to 0 to disable all XY axis movement while in air. | 1.0 |
pl_jump_control.air_inertia_scale | Scales inertia while in the air. | 0.3 |
pl_jump_control.air_resistance_scale | Scales base air resistance while in the air. | 1.3 |
You can achieve a double (or more) jump very easily through some simple Flow Graph by applying a physics impulse to the player.
In the example flow graph below here is the sequence of events:
You can increase the Math:Counter number to increase the maximum amount of secondary jumps the player can perform.
Below you'll find a copy of the Double-Jump Flow Graph which can be copy/pasted directly into Flow Graph:
<Graph Description="" Group="">
<Nodes>
<Node Id="2" class="Actor:PlayerIsInAir" pos="140,-100,0" flags="1">
<Inputs />
</Node>
<Node Id="7" class="Input:Action" pos="-140,-80,0" flags="1">
<Inputs entityId="0" Action="jump" ActionMap="player" NonDevMode="0"/>
</Node>
<Node Id="11" class="Actor:LocalPlayer" pos="-360,-140,0" flags="1">
<Inputs />
</Node>
<Node Id="14" class="Game:Start" pos="-580,-140,0" flags="1">
<Inputs InGame="1" InEditor="1"/>
</Node>
<Node Id="16" class="Physics:ActionImpulse" pos="760,-140,0" flags="1">
<Inputs entityId="0" impulse="0,0,750" angImpulse="0,0,0" Point="0,0,0" partIndex="0" CoordSys="2"/>
</Node>
<Node Id="20" class="Logic:Gate" pos="540,-100,0" flags="1">
<Inputs Closed="0"/>
</Node>
<Node Id="22" class="Math:Counter" pos="140,0,0" flags="1">
<Inputs max="2"/>
</Node>
<Node Id="34" class="Math:Equal" pos="340,0,0" flags="1">
<Inputs A="0" B="1"/>
</Node>
</Nodes>
<Edges>
<Edge nodeIn="20" nodeOut="2" portIn="In" portOut="InAir" enabled="1"/>
<Edge nodeIn="20" nodeOut="2" portIn="Open" portOut="NotInAir" enabled="1"/>
<Edge nodeIn="22" nodeOut="2" portIn="reset" portOut="NotInAir" enabled="1"/>
<Edge nodeIn="2" nodeOut="7" portIn="Trigger" portOut="Pressed" enabled="1"/>
<Edge nodeIn="22" nodeOut="7" portIn="in" portOut="Pressed" enabled="1"/>
<Edge nodeIn="7" nodeOut="11" portIn="Enable" portOut="entityId" enabled="1"/>
<Edge nodeIn="7" nodeOut="11" portIn="entityId" portOut="entityId" enabled="1"/>
<Edge nodeIn="16" nodeOut="11" portIn="entityId" portOut="entityId" enabled="1"/>
<Edge nodeIn="11" nodeOut="14" portIn="update" portOut="output" enabled="1"/>
<Edge nodeIn="16" nodeOut="20" portIn="activate" portOut="Out" enabled="1"/>
<Edge nodeIn="34" nodeOut="22" portIn="A" portOut="count" enabled="1"/>
<Edge nodeIn="20" nodeOut="34" portIn="Close" portOut="true" enabled="1"/>
</Edges>
</Graph>
The player's various movement speeds can be tweaked via CVars.
CVar | Description | Default Value |
---|---|---|
pl_movement.speedScale | Controls the standard walk speed of the player, including backwards and strafing speed. | 1.2 |
pl_movement.crouch_SpeedScale | Controls the speed of the player while crouched. | 1.0 |
pl_movement.sprint_SpeedScale | Controls the sprinting speed of the player. | 1.8 |
pl_movement.strafe_SpeedScale | Controls the amount of strafing input vs standard speedScale. | 0.9 |
pl_swimBaseSpeed | Controls the base swimming speed. See the additional pl_swim CVars for more control while in water. | 4.0 |
Several settings for view constraints are contained within this XML script: GameSDK\Scripts\Entities\actor\Parameters\Player_Params.xml
The PlayerRotation block contains maximum vertical (and horizontal, while sliding) view limits for various scenarios:
<PlayerRotation>
<Normal>
<Vertical angle_min="-70" angle_max="80" />
</Normal>
<Crouch>
<Vertical angle_min="-70" angle_max="80" />
</Crouch>
<Sliding>
<Horizontal angle_min="0" angle_max="100" />
<Vertical angle_min="0" angle_max="40" />
</Sliding>
<Sprinting>
<Vertical angle_min="-35" angle_max="45" />
</Sprinting>
<Swim>
<Vertical angle_min="-45" angle_max="80" />
</Swim>
<MountedGun>
<Vertical angle_min="-89" angle_max="60" />
</MountedGun>
</PlayerRotation>