- Home /
Ah! I’m bouncing and clipping!
Ah, yes, the bugs are back in town! I did not want to post two questions in one day so that’s why I did not ask this yesterday. I have two issues. The first one being my character is clipping through the climb of a hill when I run.
Script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Movement : MonoBehaviour
{
public float x, y, z, rotX, rotY;
public GameObject cam;
public float sens;
public float speed = 20;
public Vector3 deltaMove;
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
}
void Update()
{
transform.Rotate(0, rotX * sens, 0);
cam.transform.Rotate(-rotY * sens, 0, 0);
x = Input.GetAxisRaw("Horizontal");
z = Input.GetAxisRaw("Vertical");
rotX = Input.GetAxis("Mouse X");
rotY = Input.GetAxis("Mouse Y");
if (Input.GetKeyDown(KeyCode.Space)) y++;
if (Input.GetKeyUp(KeyCode.Space))
{
while (y <= 1)
{
y += 0.1f;
}
}
//if (Input.GetKeyDown(KeyCode.LeftControl)) y--;
if (Input.GetKeyUp(KeyCode.LeftControl)) y++;
if (Input.GetKeyDown(KeyCode.LeftShift)) speed = 20;
if (Input.GetKeyUp(KeyCode.LeftShift)) speed = 10;
deltaMove = new Vector3(x, y, z) * speed * Time.deltaTime;
transform.Translate(deltaMove);
}
}
That is literally the only script I have in the project! (Coming from using core language graphics programming like DX in C++ or Java it is barely anything!) the second thing is my character is bouncing after I jump but I have no physics objects just a Rigidbody! Thanks!
Update: I HAVE FIGURED OUT HOW TO STOP THE BOUNCING BUT STILL NOT THE CLIPPING. I ALSO NEED TO KNOW HOW TO KEEP GOING UP UNTIL I SAY TO FALL AGAIN.
Answer by aidandalzell833 · Jun 15, 2021 at 11:58 PM
I just followed https://youtu.be/nfX8cnRxrHg and I figured all of it out!
Your answer
Follow this Question
Related Questions
Stop picked up object clipping through walls? 0 Answers
my character is clipping through walls, nothing helps 1 Answer
Sphere falling through the plane 3 Answers
Clipping Boxes 1 Answer