- Home /
Question by
PandaGames_ · Dec 13, 2018 at 02:17 AM ·
unity 5movementplayerplayer movement
Zig Zag movement Unity
Hello, I'm trying to make a zig zag movement similar to the geometry dash wave movement. I cannot find a solution anywhere. Here is a picture:
geowave.png
(252.6 kB)
Comment
Answer by Cornelis-de-Jager · Dec 13, 2018 at 03:09 AM
Zig zagging is just a turn in 90 degrees. So turn it 90 degrees to start off with then rotate it en key press by 90 degrees
bool Zig = true;
void Update () {
if (Input.GetKeyDown (KeyCode.Space)) {
if (Zig)
Transform.Rotate(Qauternion.Euler( 0 , 90, 0 ));
else
Transform.Rotate(Qauternion.Euler( 0 , 90, 0 ));
Zig = !Zig;
}
}
Answer by PandaGames_ · Dec 13, 2018 at 05:18 AM
@Cornelis-de-Jager Hello, thank you so much for the reply. Sorry, I was not very clear. I am actually looking for how they made the trail behind the player.
Your answer
Follow this Question
Related Questions
player not moving over the bridge 1 Answer
MultiPorposeCameraRig makes the camera float 0 Answers
Player movement 1 Answer
Photon Network Movement Delay 1 Answer