This is a simple and versatile script designed to handle player movement in your Unity game projects.
- Smooth and responsive player movement.
- Support for both keyboard and joystick input.
- Customizable movement speed and acceleration.
- Jumping functionality with adjustable jump height.
- Ground detection to prevent mid-air jumps.
- Adjustable gravity for realistic vertical movement.
- Collision detection to handle collisions with other game objects.
- Easy integration with existing projects.
- Unity 3D (version 20XX.XX or higher)
- Clone this repository or download the ZIP file and extract it.
- Open your Unity project.
- Navigate to the desired location in your project's folder structure where you want to add the Player Movement Script.
- Copy the
PlayerMovement.csscript from the downloaded repository into your project's folder. - In the Unity editor, select the game object representing your player character.
- Add the
PlayerMovementscript component to the player object by clicking on "Add Component" and searching for "PlayerMovement".
- Attach the
PlayerMovementscript to your player character object. - Adjust the movement speed, acceleration, jump height, and gravity parameters as per your game's requirements.
- Ensure that your player character has a collider component attached to it to handle collision detection.
- Map the desired input keys or joystick axes to the corresponding input fields in the
PlayerMovementscript. - Run your game and enjoy the smooth player movement!
Contributions are welcome! If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request.