Browse Source

Merge branch 'feature-no-look-ray' into feature-third-person

This actually reverts the no-look-ray contrary to the apparent title
master
Luna 7 years ago
parent
commit
afeb8e341b
2 changed files with 28 additions and 20 deletions
  1. +25
    -17
      scenes/player.tscn
  2. +3
    -3
      scripts/heroes/1.gd

+ 25
- 17
scenes/player.tscn View File

@ -13,7 +13,7 @@ height = 0.5
length = 0.3
_sections_unfolded = [ "Resource" ]
[sub_resource type="PrismMesh" id=4]
[sub_resource type="PrismMesh" id=3]
left_to_right = 0.5
size = Vector3( 0.5, 0.5, 0.5 )
@ -21,7 +21,7 @@ subdivide_width = 0
subdivide_height = 0
subdivide_depth = 0
[sub_resource type="CapsuleMesh" id=3]
[sub_resource type="CapsuleMesh" id=4]
radius = 0.4
mid_height = 0.1
@ -105,26 +105,17 @@ lod_min_distance = 0.0
lod_min_hysteresis = 0.0
lod_max_distance = 0.0
lod_max_hysteresis = 0.0
mesh = SubResource( 4 )
mesh = SubResource( 3 )
skeleton = NodePath("..")
material/0 = null
_sections_unfolded = [ "Transform" ]
[node name="MeshInstance" type="MeshInstance" parent="Yaw" index="1"]
[node name="Ray" type="RayCast" parent="Yaw/Pitch" index="1"]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0.787368, 0 )
layers = 1
material_override = null
cast_shadow = 1
extra_cull_margin = 0.0
use_in_baked_light = false
lod_min_distance = 0.0
lod_min_hysteresis = 0.0
lod_max_distance = 0.0
lod_max_hysteresis = 0.0
mesh = SubResource( 3 )
skeleton = NodePath("..")
material/0 = null
enabled = true
exclude_parent = true
cast_to = Vector3( 0, 0, -100 )
collision_mask = 1
_sections_unfolded = [ "Transform" ]
[node name="MasterOnly" type="Node" parent="." index="4"]
@ -196,4 +187,21 @@ size = 1.0
near = 0.05
far = 100.0
[node name="MeshInstance" type="MeshInstance" parent="." index="6"]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0.787368, 0 )
layers = 1
material_override = null
cast_shadow = 1
extra_cull_margin = 0.0
use_in_baked_light = false
lod_min_distance = 0.0
lod_min_hysteresis = 0.0
lod_max_distance = 0.0
lod_max_hysteresis = 0.0
mesh = SubResource( 4 )
skeleton = NodePath("..")
material/0 = null
_sections_unfolded = [ "Transform" ]

+ 3
- 3
scripts/heroes/1.gd View File

@ -23,10 +23,10 @@ func _process(delta):
if is_placing_wall:
# Find the point we're looking at, and put the wall there
var aim = get_node("Yaw/Pitch").get_global_transform().basis
var camera = get_node("Yaw/Pitch/Camera")
var pos = camera.project_position(Vector2())
var look_ray = get_node("Yaw/Pitch/Ray")
var pos = look_ray.get_collision_point()
placing_wall_node.set_translation(pos)
var towards = camera.project_ray_normal(Vector2()) + pos
var towards = look_ray.get_collision_normal() + pos
var up = -aim[2] # Wall should be horizontal to my view
placing_wall_node.look_at(towards, up)


Loading…
Cancel
Save