Hello! I am receiving difficulties with my code (yet again!) and this time it seems to be with my jumping and gravity fall speed. I have tried to rewrite it, but I still haven’t found the problem. Below I have included my code and I would appreciate any help I can get!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FirstPersonController : MonoBehaviour {
public float movementSpeed = 5.0f;
public float mouseSensitivity = 5.0f;
public float jumpSpeed = 2.0f;
float verticalRotation = 0;
public float upDownRange = 60.0f;
float verticalVelocity = 0;
// Use this for initialization
void Start () {
Cursor.visible = false;
}
// Update is called once per frame
void Update () {
//Rotataion
float rotLeftRight = Input.GetAxis(“Mouse X”) *mouseSensitivity;
transform.Rotate(0, rotLeftRight, 0);
float rotUpDown = Input.GetAxis(“Mouse Y”) * mouseSensitivity;
Alright. Thanks for pointing that out! With the gravity, when you fall you are to fall slowly at first and increase speed as you drop(like normal physics). However, my ‘Player’ falls at a consistent slow pace. That is what I’m trying to fix. Onto the jumping part, when I click the “Jump” button to well, jump, my ‘Player’ seems to teleport to the sky then slowly falls down(ties to the gravity part). It seems very unrealistic and I was hoping for some help with the matter.
I haven’t used the CharacterController class myself, so I’m not familiar with it, but have you taken a look at the documentation page for CharacterController.Move? It looks to me to have an example for exactly what you are trying to do.