Pawn Physics For Roller Blade Movement
✍ Last Updated : October 5, 2022
🚪 Prequisite Knowledge (Optional)
Describe Initial Knowledge that reader need to know before reading this article
❓ Key Question / Problem / Issue
There is no roller blade movement in unreal
✅ Expected Output/Definition of Done
Define what information you really need and the definition of done
🎁 Resulting Solution
-
Using Pawn instead of Character for easier customization
-
Using Capsule for physics and collisions
-
Using Capsule Trace to find ground normal to keep the character upright, when no ground is found, use vector up as normal (TODO : change trace to capsule overlap, using slightly bigger capsule, might eliminate collision issues below)
-
Using Animation Graph to handle animation blendings
-
Collision issue (player stuck) when hitting wall at angled floor → OnCapsuleCollision Event, use reflection vector from capsule forward and wall normal, and use it as player’s forward to bounce player away from wall
-
Importing 3D model (fbx) for level ⇒ In Mesh Windows, Tab Details → Collision → Collision Complexity = Use Complex Collision as Simple
-
Camera : Still cant figure how to set default camera to spawned camera. Current solution, use default setup using springarm and camera, but detach camera when game start, then follow player manually
-
Multiplayer: Pawn doesnt automatically replicated/synced. Need to handle replication manually
- On Input Events and Tick Event, check if current pawn has authority, if it has, process input locally, else send event to server
- When Server receive Input events from client, process the input using the same process as local.
- After All Tick Functions have been processed, send Event to send all transformations to clients\
- When Client receives Transformation Event, apply transformation to Pawn
- All variables that affect animations can be replicated automatically
- TODO : Interpolation & Extrapolation between Transformation Events
-
Calculating Ping:
- Unreal’s session ping always return 9999 for some reason. Need a way to calculate ping manually.
- Ping is needed for interpolation and prediction
- Ping also needed for input processing, when turning/accelerating/braking networked players, ping is used instead of deltaTime
- Ping is calculated by sending a ping event to server with timeStamp parameter, then server sendback the event to client. Then when receiving back the ping event, client can substract current time with the timestamp and divide it by 2
- TODO : currently each player in local machine is calculating the same ping, create an actor that the main purpose is to calculate ping
-
Interpolation
- When client received Transformation Event, instead of directly moving the player to received transform, it saves the transform as target transfomation. Also reset interpolator timer to 0;
- Then for every next tick, interpolate from previous received transform to target transformation using interpolator divided by ping as interpolation amount.
T = TLerp(T0, T1, interpolator/ping)
- Still not working properly due to ping is always 9999
-
Obstacles
- Boost Tile use decal to ensure that it conform the terrain/road under it. Using Box overlap to detect if player is affected
- Mud also use decal and box overlap like Boost Tile
- Thwomp and moving obstacles are replicated from server to client
No Comments