0
Answered

Can I change the direction of movement?

Link 5 months ago in Game Creator updated by Marti (Lead Developer) 5 months ago 7

When I press the move button, it will move as shown in the red line below.
But I want it to move in the direction of the blue line.
Can it be done?

Cheers!

Unity version:
2019.3.6
Game Creator version:
1.1.7

Answer

+1
Answer

Sure, find the following line in PlayerCharacter.cs (probably line 144):


    this.characterLocomotion.SetDirectionalDirection(moveDirection);

 

Change it to the following:

    this.characterLocomotion.SetDirectionalDirection(Quaternion.Euler(0, 45, 0) * moveDirection);

If you need to change the forward angle, just replace 45 with something else.

GOOD, I'M SATISFIED
Satisfaction mark by Link 5 months ago

You would need to experiment with this to get it how you want, but in the Player Character, there is Advanced Parameters. Within this, you can change Movement Direction to Target and set various targets with offsets.

I haven't played with this, but I am guess that you should be able to create something close to what you need.

Hope this helps.

Thank you for your answer, but this doesn't seem to work. Because this is Face Direction

Are you still looking for a solution? If you are comfortable with changing the source code I can provide a quick fix for you.

Yes, I am. If you are free, please help me. I am not good at coding. Thank you very much

+1
Answer

Sure, find the following line in PlayerCharacter.cs (probably line 144):


    this.characterLocomotion.SetDirectionalDirection(moveDirection);

 

Change it to the following:

    this.characterLocomotion.SetDirectionalDirection(Quaternion.Euler(0, 45, 0) * moveDirection);

If you need to change the forward angle, just replace 45 with something else.

Wow, I did it. Thank you so much! ! !