#Why does this happen?

5 messages · Page 1 of 1 (latest)

digital wave
#

This happens everytime I try to apply a velocity to an imported 3d character.

#
extends CharacterBody3D
#
const GROUND_FRICTION = 3
var friction = 3
var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
var isMoving = false

@export var maxSpeed = 20.0
@export var acceleration = 2.0
@export var jumpHeight : float
@export var jumpTimeToPeak : float
@export var jumpTimeToDescend : float

@onready var jumpVelocity : float = ((2.0 * jumpHeight / jumpTimeToPeak))
@onready var jumpGravity : float = ((-2.0 * jumpHeight) / (jumpTimeToPeak * jumpTimeToPeak))
@onready var fallGravity : float = ((-2.0 * jumpHeight) / (jumpTimeToDescend * jumpTimeToDescend))
@onready var character_body_3d = $drio


## Respawn character at designated coordinates
func respawn(spawnX = 0, spawnY = 4, spawnZ = 0):
    character_body_3d.position.x = spawnX
    character_body_3d.position.y = spawnY
    character_body_3d.position.z = spawnZ

# Jump
func jump():
    velocity.y = jumpVelocity

# Get gravity
func get_gravity() -> float:
    return jumpGravity if velocity.y > 0.0 else fallGravity

func _physics_process(delta):
    # Add the gravity.
    velocity.y += get_gravity() * delta

    move_and_slide()

heres the script attached to the character and the list

sour goblet
#

you're dividing by 0, look for these /

digital wave
#

?

#

ohhh