I need some help with my collision; it just doesn't work consistently.
The collider is a CollisionShape3D, and a CapsuleShape for the shape.
I tried to change the physics from Godot to Bullet but it broke both times.
The ground is a StaticBody with a CollisionShape3D, the shape is a rectangular prism.
Using a cylinder instead of a capsule completly breaks the collision
Help thanks!
Example of the problem: [
Movement:
var dir := Vector3.ZERO
dir.x = Input.get_action_strength("right") - Input.get_action_strength("left")
dir.z = Input.get_action_strength("backward") - Input.get_action_strength("forward")
dir = dir.rotated(Vector3.UP, _cam_arm.rotation.y).normalized()
_velocity.x = dir.x * speed
_velocity.z = dir.z * speed
if not is_on_floor():
_velocity.y -= Gbl.gravity * dt
var just_landed := is_on_floor() and _snap_vector == Vector3.ZERO
var is_jumping := is_on_floor() and Input.is_action_just_pressed("jump")
if is_jumping:
_velocity.y = jump_power
_snap_vector = Vector3.ZERO
elif just_landed:
_snap_vector = Vector3.DOWN
_velocity = move_and_slide_with_snap(_velocity, _snap_vector, Vector3.UP, true)
if _velocity.length() > 0.2:
var look_direction = Vector2(_velocity.z, _velocity.x)
_model.rotation.y = look_direction.angle()
moving = true
else:
moving = false