I watched a very informative tutorial on this ball player controller, and then i went and found a really good 3rd person camera controller w/ a h/v parent system, they both work great on their own, but when i put the clipped camera under the player controller to connect them, the player doesn't move or rotate, but the camera rotates all around when i try to move. can anyone help me with this? i just want a 3rd person camera to follow my ball around, but now my ball won't move :(
here's the scripts:
PLAYER SCRIPT
extends RigidBody
var movement_input = Vector3()
func _ready():
pass
func physicsprocess(delta):
processinput(delta)
processmovement(delta)
if Input.is_action_just_pressed("r"):
get_tree().reload_current_scene()
func processinput(delta):
movementinput = Vector3.ZERO
if Input.is_action_pressed("move_forward"):
movement_input.z -= 1
if Input.is_action_pressed("move_back"):
movement_input.z += 1
if Input.is_action_pressed("strafe_left"):
movement_input.x -= 1
if Input.is_action_pressed("strafe_right"):
movement_input.x += 1
print(movement_input)
movement_input = movement_input.normalized()
func processmovement(delta):
applyimpulse(Vector3.ZERO, movement_input)
CAMERA SCRIPT
extends Spatial
var camroth = 0
var camrotv = 0
var camvmin = -55
var camvmax = 75
var hsensitivity = 0.1
var vsensitivity = 0.1
var hacceleration = 10
var vacceleration = 10
func ready():
Input.setmousemode(Input.MOUSEMODE_CAPTURED)
$h/v/Camera.add_exception(get_parent())
func input(event):
if event is InputEventMouseMotion:
camroth += -event.relative.x * hsensitivity
camrotv += event.relative.y * v_sensitivity
func physicsprocess(delta):
camrot_v = clamp(camrot_v, cam_v_min, cam_v_max)
$h.rotation_degrees.y = lerp($h.rotation_degrees.y, camrot_h, delta * h_acceleration)
$h/v.rotation_degrees.x = lerp($h/v.rotation_degrees.x, camrot_v, delta * v_acceleration)