Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

155
Vistas
player controller jitters unity

when I jump up to an object that is a cube I reach the step offset and it jitters for a little bit before falling to the ground again. I can remove the step offset altogether but that's not what I want as my game is baste around parkour. when I was making this I was following a Brackeys tutorial on YouTube. Brackeys tutorial. can anyone help me out? ,first person object , the object causing most problems, objects in scene

using System.collections;
using System.Collections.Generic;
using UnityEngine;

public class keymovement : MonoBehaviour
{
public CharacterController controller;


public float speed = 12f;
public float gravity = -10f;

public Transform groundcheck;
public float groundDistance = 0.5f;
public LayerMask groundMask;

public float jumpheight = 3f;

Vector3 velocity; 
bool isgrounded;


void Update()
{
    isgrounded = Physics.CheckSphere(groundcheck.position, groundDistance, groundMask);

   

    if (isgrounded && velocity.y < 0)

    {
        velocity.y = -2;
  }

    float x = Input.GetAxis("Horizontal");
    float z = Input.GetAxis("Vertical");

    Vector3 move = transform.right * x + transform.forward * z;
    
    controller.Move(move * speed * Time.deltaTime);

    if (Input.GetButton("jump") && isgrounded)
    {
        velocity.y = Mathf.Sqrt(jumpheight * -2f * gravity);
    }

    velocity.y += gravity * Time.deltaTime;

    controller.Move(velocity * Time.deltaTime);
    }

      
    }
    }
    }
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Basically, the Character controller is fighting with the velocity of the movement script because of how it checks for slopes and steps.

An easy fix is to set the controller's slopeLimit to 90f while you are jumping:

void Update()
{
    isgrounded = Physics.CheckSphere(groundcheck.position, groundDistance, groundMask);

    if (isgrounded && velocity.y < 0)

    {
        velocity.y = -2;
        controller.slopeLimit = 45f;
    }
    
    float x = Input.GetAxis("Horizontal");
    float z = Input.GetAxis("Vertical");

    Vector3 move = transform.right * x + transform.forward * z;

    controller.Move(move * speed * Time.deltaTime);

    if (Input.GetButton("Jump") && isgrounded)
    {
        velocity.y = Mathf.Sqrt(jumpheight * -2f * gravity);
        controller.slopeLimit = 90f;
    }

    velocity.y += gravity * Time.deltaTime;

    controller.Move(velocity * Time.deltaTime);
}
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda