Refactors the character controller components #295
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The CC shape component (former "proxy") is now more basic, and has no specialized functionality like crouching anymore. Since it now has a base class, it can be replaced with a custom implementation more easily. This is for example needed when you want to replace the collision filtering behavior and some other low level CC behavior.
The ezPxCharacterController now implements the previous higher level functionality. Since it mainly acts as an example, it's no problem to have such features there.
The CC now also supports teleporting.
The origin of the CC was previously at its center. Crouching meant the CC got smaller and then basically fell to the floor. Other parts, like where the camera was located, didn't move at all during crouching, meaning they weren't really resized.
Now the origin of the CC is at its bottom. This helps placing the CC properly (teleporting, start point, etc). It has the side effect that resizing (crouching) has no effect on the camera position anymore.
There are many ways this could be handled. The ezPxCharacterController now takes a reference to a 'head object' (child node). Upon crouching, it will move that child object up and down.
If you have a custom CC impl, you will need to implement crouching behavior now as well.