0 votes

Hey everyone, I am a complete beginner in game scripting. I can handle most 3d stuff, textures, and gui, but I just can't get the scripting right. I am trying to get a 3d kinematic character script for third person. Basically, I want it to be able to do this:

extends KinematicBody

var t
var r

export var MSpeed = 10
export var RSpeed = 10

func _process(dt):
    t = get_transform()
    r = get_rotation()

        t.origin += t.basis[2] * -MSpeed * dt

        t.origin += t.basis[2] * MSpeed * dt

        r += Vector3(0,-1,0) * RSpeed * dt

        r += Vector3(0,1,0) * RSpeed * dt


func _ready():

But with gravity, and collision detection. Is there any easy way? Or a tutorial that shows how?

in Engine by (88 points)

1 Answer

0 votes

try to do it in _fixed_process() not in _process()

func _fixed_process(delta):

func _ready():
by (685 points)

But that is not going to add physics, or kinematics, is it?

Automatic physics you only get with a rigidbody.

In a kinematicbody you need to programmatic simulate your own.

Some 3D physic tutorials Godot Engine: Roll A Ball Tutorial

All right yes thanks. I have already followed the tutorial (downloaded the series on my hard drive;)), however, being a complete beginner, I'm having a hard time too repurpose the controller to my specifications. And I couldn't find a conclusive to tutorial for 3d kinematic bodies.

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 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 webmaster@godotengine.org with your username.