So I have a KinematicBody that has a collision shape for it and a mesh node for it. I have it set up in the code to move forward when i press w. This is the basics of the code.<br><br>
if move_forward == true:<br> player.move(Vector3(0,0,1))<br>
Player is just a shortcut I made its linked to <br>
get_node("player")<br>
<p>The error I get in the debugger is</p>
Space State Is inaccessible right now, wait for iteration or fixed process notification. <br>
<p>And my character doesn't move. <br></p><p>What is happening? <br></p><p><br></p><p>EDIT:</p><p>Ok so I looked into some demos and found this</p>
extends KinematicBody<br><br>const ACCEL= 2<br>const DEACCEL= 4<br>const MAX_SPEED = 10<br><br>var vel = Vector3()<br><br>onready var cam = get_node("cam")<br><br>func
ready():<br> set_fixed_process(true)<br><br>func fixed_process(delta):<br> var dir = Vector3() # Where does the player intend to walk to<br> var cam_xform = cam.get_global_transform()<br><br> if Input.is_key_pressed(KEY_W):<br> dir += -cam_xform.basis[2]<br> if Input.is_key_pressed(KEY_S):<br> dir += cam_xform.basis[2]<br> if Input.is_key_pressed(KEY_A):<br> dir += -cam_xform.basis[0]<br> if Input.is_key_pressed(KEY_D):<br> dir += cam_xform.basis[0]<br> dir.y = 0<br> dir = dir.normalized()<br> var hvel = vel<br> hvel.y = 0<br> var target = dir
MAX_SPEED<br> var accel<br> if (dir.dot(hvel) > 0):<br> accel = ACCEL<br> else:<br> accel = DEACCEL<br> hvel = hvel.linear_interpolate(target, acceldelta)<br> vel.x = hvel.x<br> vel.z = hvel.z<br> move(vel*delta)
<p>So Can some one explain how and why this works? I understand the cam_xform.basis but besides that Im confused <br></p><br><br>