in the future - u will be able to do some more stuff here,,,!! like pat catgirl- i mean um yeah... for now u can only see others's posts :c
āŖ@Herobrinepleaz9ā¬ yo I got banned from commenting for 13 hours (I have no idea why) but ig thatās the first time Iāve seen you plug your discord server
4 - 2
YOO GUYS I JUST 200 SUBSCRIBERS BUT I WASNT PERPARED??!!?! SO IM LEAVING IT TO YOU GUYS WHAT I SHOULD DO!
3 - 8
You thought I would leave you hanging? Free Running script for unity (works with the last one)
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public float moveSpeed = 5f; // Speed of normal movement
public float sprintSpeed = 10f; // Speed when sprinting
public float rotationSpeed = 180f; // Speed of rotation
private bool isSprinting = false;
void Update()
{
// Input handling
float horizontalInput = Input.GetAxis("Horizontal"); // A/D keys or left/right arrow keys
float verticalInput = Input.GetAxis("Vertical"); // W/S keys or up/down arrow keys
bool sprintInput = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift); // Shift key for sprinting
// Determine current speed
float currentMoveSpeed = isSprinting ? sprintSpeed : moveSpeed;
// Movement calculation
Vector3 moveDirection = new Vector3(horizontalInput, 0f, verticalInput).normalized;
Vector3 movement = moveDirection * currentMoveSpeed * Time.deltaTime;
// Rotate the player towards the movement direction (if moving)
if (moveDirection != Vector3.zero)
{
Quaternion targetRotation = Quaternion.LookRotation(moveDirection);
transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, rotationSpeed * Time.deltaTime);
}
// Move the player
transform.Translate(movement, Space.World);
// Check for sprint input
if (sprintInput && !isSprinting)
{
isSprinting = true;
}
else if (!sprintInput && isSprinting)
{
isSprinting = false;
}
}
}
1 - 0
Free Movement script for unity:
public class PlayerMovement : MonoBehaviour
{
public float moveSpeed = 5f; // Speed of movement
public float rotationSpeed = 180f; // Speed of rotation
void Update()
{
// Input handling
float horizontalInput = Input.GetAxis("Horizontal"); // A/D keys or left/right arrow keys
float verticalInput = Input.GetAxis("Vertical"); // W/S keys or up/down arrow keys
// Movement calculation
Vector3 moveDirection = new Vector3(horizontalInput, 0f, verticalInput).normalized;
Vector3 movement = moveDirection * moveSpeed * Time.deltaTime;
// Rotate the player towards the movement direction (if moving)
if (moveDirection != Vector3.zero)
{
Quaternion targetRotation = Quaternion.LookRotation(moveDirection);
transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, rotationSpeed * Time.deltaTime);
}
// Move the player
transform.Translate(movement, Space.World);
}
}
1 - 0
Hello everyone! Even though I'm a Geometry Dash Youtuber, I decided that me, the terrible coder, would tackle trying to make a game in unity...
Someone please tell me what I'm getting into...
1 - 0
Subscribe for a cookie! šŖ