25 lines
No EOL
1,016 B
GDScript
25 lines
No EOL
1,016 B
GDScript
extends Spatial
|
|
|
|
func _process( delta ):
|
|
|
|
if Input.is_action_pressed("move_forward"):
|
|
$dummy/camera_stand.translate( Vector3( 0.0, 0.0,-10.0*delta ) )
|
|
if Input.is_action_pressed("move_backward"):
|
|
$dummy/camera_stand.translate( Vector3( 0.0, 0.0, 10.0*delta ) )
|
|
if Input.is_action_pressed("move_left"):
|
|
$dummy/camera_stand.translate( Vector3(-10.0*delta, 0.0, 0.0 ) )
|
|
if Input.is_action_pressed("move_right"):
|
|
$dummy/camera_stand.translate( Vector3( 10.0*delta, 0.0, 0.0 ) )
|
|
|
|
func _input(event):
|
|
|
|
if event.is_action_pressed( "move_look" ):
|
|
Input.set_mouse_mode( Input.MOUSE_MODE_CAPTURED )
|
|
elif event.is_action_released( "move_look" ):
|
|
Input.set_mouse_mode( Input.MOUSE_MODE_VISIBLE )
|
|
|
|
if event is InputEventMouseMotion:
|
|
if Input.is_action_pressed( "move_look" ):
|
|
$dummy/camera_stand/camera.rotate_x( -event.relative.y * 0.01 )
|
|
$dummy/camera_stand.rotate_y( -event.relative.x * 0.01 )
|
|
|