Added a new scene
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
extends RigidBody3D
|
||||
|
||||
# Initially I used a CharacterBody3D, however, I wanted the player to bounce off
|
||||
# other objects in the environment and that would have required manual handling
|
||||
# of collisions. So that's why we're using a RigidBody3D instead.
|
||||
|
||||
const ACCELLERATION = 5.0
|
||||
|
||||
func _integrate_forces(state):
|
||||
var input_dir = Vector3.ZERO
|
||||
input_dir.x = Input.get_action_strength("ui_right") - Input.get_action_strength("ui_left")
|
||||
input_dir.z = Input.get_action_strength("ui_down") - Input.get_action_strength("ui_up")
|
||||
input_dir = input_dir.normalized()
|
||||
|
||||
linear_velocity.x += input_dir.x * (ACCELLERATION * state.step)
|
||||
linear_velocity.z += input_dir.z * (ACCELLERATION * state.step)
|
||||
Reference in New Issue
Block a user