- Home /
Similar movement to a game (look description)
So i am working on a game that will have all physics, almost the same as the game "King of Crabs" (by Robot Squid "created by Ubisoft")
I still haven't figured out how to imitate the "crabs" movement. If anyone could help me, don't make a crab movement script that moves to the sides, cus I just need my player to move in all directions, clicking "SPace" to sprint and NEVER leave the ground, (cus my player is actually a slug) with that, I will be so gratefull :)
I can reward users THANKSS
(i've been in this since like 5 days ago)
Answer by Shadex · Apr 11, 2021 at 08:52 AM
Dude, it's nearly impossible to understand what you wrote. Anyways, this is most likely what your after
Vector3 playerForward = /* Get the angle that the player is facing */
Vector3 playerRight = Vector3.Cross(Vector3.forward, playerForward);
player.position += playerRight * Input.GetAxis("Horizontal") * movementSpeed;
player.position += playerForward * Input.GetAxis("Vertical") * movementSpeed;
That's Omnidirectional movement. The rest is just animations.
Your answer
Follow this Question
Related Questions
My player still keep moving when i unparent it form the car 2 Answers
Idle Animation and Hold to Move 0 Answers
Rigidbody.MovePosition not really smooth 2 Answers
Distribute terrain in zones 3 Answers
Player Movement Help 0 Answers