This kinda works but It's very floaty and sprite remains the same regardless of what direction is facing. Welcome back to this new series where were going to learn the basics of creating a 3D platformer in Unity In this episode well take a look at how to move. In this tutorial, I will be showing how to add moving platform support for CharacterController in Unity 3D. Vector3 move = transform.right * horizontalMove ĬharacterController.Move(speed * ltaTime * move + gravityMove * ltaTime) Īnimator.SetBool("isWalking", verticalMove != 0 || horizontalMove != 0) Vector3 gravityMove = new Vector3(0, verticalSpeed, 0) In this article, I’ll be setting up a physics-based character controller for the Player through the script.
If (characterController.isGrounded) verticalSpeed = 0 Įlse verticalSpeed -= gravity * ltaTime I have a capsule character and a moving platform to the right of the character’s platform. 2D Platformer is a type of game where the player jumps between platforms, avoids obstacles, and fights enemies, all of which is observed from a 2D side-view perspective. Public CharacterController characterController Ĭursor.lockState = CursorLockMode.Locked įloat horizontalMove = Input.GetAxis("Horizontal") įloat verticalMove = Input.GetAxis("Vertical") I am working on a simple platformer, but with a 3D visualization. Public class TelekinesisFunction : CommandĬommand keyX = new TelekinesisFunction() Set the player layer in the Player Controller asset located at Tarodev 2D Controller/Stat Presets/Player Controller Thats it Check the demo scene if youre stuck :) Feel free to use the code in your production games. Solutions I've tried so far involve using Physics2D, but this fails as the players goes trough the ground when standing on 3D objects, or I've seen the use of Character Controller but I can't quite understand this approach as I don't understand how to change the keys or flip the sprite. It is a super easy-to-follow video that will show you everything you need for a stunnin. I'm making a 2D platformer with a 3D environment but a 2D player (using sprites). In this video, I will teach you how to make a 3D platformer in Unity. I've looked everywhere and I can't find a good solution to this.