- Character controls
Character controls are implemented with WASD or an xbox gaming controller. When a character moves, the forward and right move vectors are calculated based on the current terrain the character is standing on and the position of the camera. The character model was also rotated to face the direction of travel. This was a complex procedure. Calculating which terrain the player is standing on was initially calculated using the Triangle Picking sample found on the XNA creators club website. The method in the sample looped through every triangle in the level model to find which triangle intersected the player's down vector. This was highly inefficient and had to be modified in a later stage.
Gravity was also implemented in a similar method; search through all gravity points to find the nearest and use that as gravity. This caused 2 issues. The first issue was that when a level got larger and if there were a few characters in the level, the CPU would be overloaded with calculating which terrain and gravity to use. The second issue was that the character would snap to the nearest gravity point, causing lots of jittery movements. These issues would be resolved in a later stage.
Using an analog controller like the xbox controller thumbsticks created a very smooth movement.
No comments:
Post a Comment