Make Player a KinematicBody

This commit is contained in:
Fabien Freling 2018-07-19 15:36:56 +02:00
parent d6afcd4f70
commit 206bf0ae44
2 changed files with 38 additions and 14 deletions

View file

@ -1,14 +1,17 @@
extends Spatial
extends KinematicBody
# class member variables go here, for example:
# var a = 2
# var b = "textvar"
var velocity = Vector3()
func _ready():
# Called every time the node is added to the scene.
# Initialization here
pass
func _physics_process(delta):
var direction = Vector3()
# if Input.is_action_pressed("movement_forward"):
#func _process(delta):
# # Called every frame. Delta is time since last frame.
# # Update game logic here.

View file

@ -1,15 +1,20 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=6 format=2]
[ext_resource path="res://Player.gd" type="Script" id=1]
[sub_resource type="CapsuleMesh" id=1]
[sub_resource type="CapsuleShape" id=1]
radius = 1.0
height = 1.0
[sub_resource type="CapsuleMesh" id=2]
radius = 1.0
mid_height = 1.0
radial_segments = 64
rings = 8
[sub_resource type="Shader" id=2]
[sub_resource type="Shader" id=3]
code = "shader_type spatial;
@ -17,16 +22,32 @@ void fragment() {
ALBEDO = vec3(1.0, 0.0, 0.0);
}"
[sub_resource type="ShaderMaterial" id=3]
[sub_resource type="ShaderMaterial" id=4]
render_priority = 0
shader = SubResource( 2 )
shader = SubResource( 3 )
[node name="Player" type="Spatial"]
[node name="Player" type="KinematicBody" index="0"]
input_ray_pickable = true
input_capture_on_drag = false
collision_layer = 1
collision_mask = 1
axis_lock_linear_x = false
axis_lock_linear_y = false
axis_lock_linear_z = false
axis_lock_angular_x = false
axis_lock_angular_y = false
axis_lock_angular_z = false
collision/safe_margin = 0.001
script = ExtResource( 1 )
[node name="MeshInstance" type="MeshInstance" parent="." index="0"]
[node name="CollisionShape" type="CollisionShape" parent="." index="0"]
shape = SubResource( 1 )
disabled = false
[node name="MeshInstance" type="MeshInstance" parent="." index="1"]
layers = 1
material_override = null
@ -37,9 +58,9 @@ lod_min_distance = 0.0
lod_min_hysteresis = 0.0
lod_max_distance = 0.0
lod_max_hysteresis = 0.0
mesh = SubResource( 1 )
mesh = SubResource( 2 )
skeleton = NodePath("..")
material/0 = SubResource( 3 )
material/0 = SubResource( 4 )
_sections_unfolded = [ "material" ]