Shadow movement V2 – Input Orientation to World

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.

180 Bug

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,

Shadow movement V2 – Input Orientation to World

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s