A player actor is a player with a rigid physical body, which is approximated with a capsule and has physical properties. Unlike all other players that can move in any direction, the player actor can only walk on the ground.
- When changing the theta angle, the vertical view direction of the player actor changes.
- When changing the phi angle, the horizontal view direction and the basis of the player actor change.
If you need a player actor to go up and down a staircase smoothly, without getting stuck on each stair, you should carefully adjust the radius of the capsule that approximates the player. Or you can approximate the staircase with a plane: in this case, the capsule can be of any radius.
The height of the player's capsule should also be set correctly to avoid getting stuck in a doorway.
- A PlayerActor class to edit players via UnigineScript
- A set of samples located in the data/samples/players/ folder:
When a player actor is not simulated as a rigid body, a simple dummy body with a capsule shape is used to calculate collisions:
- All contacts with the shape are found.
- The player actor is pushed out of objects it collided with along the contact normal (the global penetration factor is also taken into account here). Effectively, it's a sum of all normal vectors of found contacts.
- The velocity change is calculated: the initial velocity vector is projected onto each contact normal (the dot product is calculated) and the result is subtracted from the initial velocity.
Editing a Player Actor