This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

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:


extends RigidBody

var movement_input = Vector3()

func _ready():

func physicsprocess(delta):

if Input.is_action_just_pressed("r"):

func processinput(delta):
input = 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


movement_input = movement_input.normalized()

func processmovement(delta):
impulse(Vector3.ZERO, movement_input)


extends Spatial

var camroth = 0
var camrot
v = 0
var camvmin = -55
var camvmax = 75
var hsensitivity = 0.1
var v
sensitivity = 0.1
var hacceleration = 10
var v
acceleration = 10

func ready():


func input(event):
if event is InputEventMouseMotion:
h += -event.relative.x * hsensitivity
v += 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)
Godot version not sure i'm kinda new but it says gles2 in the top right corner
in Engine by (19 points)

2 Answers

0 votes
Best answer

turns out i just had to go to the ball's rigid body and switch it to character lol,
but now i gotta figure out how to move in the direction the camera is facing ;/

by (19 points)
0 votes

Here is an example of a camera movement script in Godot Engine using GDScript that keeps the player centered while allowing them to move around:

extends Camera2D
var target : Node
var smooth_speed = 0.125
var offset = Vector2(0, 0)
func _fixed_process(delta):
    var desired_position = target.position + offset
    var smoothed_position = desired_position.lerp(position, smooth_speed)

You can use this script by attaching it to your camera object and setting the "target" variable to the player object. You can adjust the smooth_speed variable to change the speed at which the camera follows the player, and the offset variable to set the distance between the camera and the player.

You can also add some constraints on the movement of the camera depending on your level design or other requirements of your game.

This script uses the _fixed_process() function to update the camera position in every frame. This can be useful for controlling camera movement in a physics-based game, or for ensuring consistent movement across different frame rates.

by (18 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.