Before I could use the ShadowMovementV2 system in actual gameplay I needed to make the joystick input directions, and the ShadowsEntity movement direction match up in a understandable way for the player. To do this I have made it so the players movement direction, references the camera position.
The new system in engine, at the end of the loop you can see the 180 bug mentioned below.
The design for this is:
- First the script uses a transform, placed at the camera’s position, to track the script object.
- Then it records that transforms direction as a vector.
- It then flattens this directions Forward so it’s Up can be referenced as if it were the script objects local forward.
- Finally the script applies the movement input, using this stored value as it’s local forward and directs the movement script to follow accordingly.
This way the script moves in a predictable fashion to the users inputs.
This setup doesn’t work perfectly though, only faces that have normals facing in the camera direction work. This means you can not go behind objects. Because there is a clear cutoff point, I feel this is something I will probably be able to fix down the line, but I plan on leaving it for now because this bug is very easy to work around and may never actually be necessary to fix, finding a solution is low priority,