diff --git a/rinkplanner/avatar.gd b/rinkplanner/avatar.gd index c8cd3a6..2a09224 100644 --- a/rinkplanner/avatar.gd +++ b/rinkplanner/avatar.gd @@ -11,14 +11,21 @@ func _physics_process(delta: float) -> void: var target = waypoints[wp_index] if target: + #var direction = (target.global_transform.origin - global_transform.origin) var direction = (target.global_transform.origin - global_transform.origin) + direction = Vector3(direction.x, 0.0, direction.z) - var target_dir = (target.position - global_transform.origin).normalized() + var target_dir = (target.global_transform.origin - global_transform.origin).normalized() var current_dir = global_transform.basis.z.normalized() var lerp_dir = current_dir.lerp(target_dir, delta * speed) if direction.length() > 1.0: - look_at(target.global_transform.origin + lerp_dir, Vector3.UP) + #look_at(target.global_transform.origin + lerp_dir, Vector3.UP) + var look_t:Vector3 = target.global_transform.origin + lerp_dir + look_t=Vector3(target.global_position.x, 0.0, target.global_position.z) + look_at(look_t) direction = direction.normalized() + print(global_transform.origin) + direction = Vector3(direction.x, 0.0, direction.z) velocity = direction * speed move_and_slide() else: diff --git a/rinkplanner/rink.tscn b/rinkplanner/rink.tscn index 271bb18..615b6a1 100644 --- a/rinkplanner/rink.tscn +++ b/rinkplanner/rink.tscn @@ -72,7 +72,6 @@ path_joined = false material = SubResource("StandardMaterial3D_xqoi8") [node name="rink_surface" type="CSGBox3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0149655, -0.985335, 0.0267248) use_collision = true size = Vector3(60, 1, 30) material = SubResource("StandardMaterial3D_ytmxt") @@ -87,19 +86,20 @@ directional_shadow_max_distance = 50.0 environment = SubResource("Environment_ysbyt") [node name="Waypoints" type="Node3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.16534, 0) [node name="Waypoint1" type="CSGBox3D" parent="Waypoints"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -20.8539, 0, 8.70607) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -20.826, 0, 8.65) material = SubResource("StandardMaterial3D_2kbi8") [node name="Waypoint2" type="CSGBox3D" parent="Waypoints"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 23.4405, 0, 8.09644) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 23.432, 0, 8.075) [node name="Waypoint3" type="CSGBox3D" parent="Waypoints"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 21.7868, 0, -6.13789) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 21.787, 0, -6.138) [node name="Waypoint4" type="CSGBox3D" parent="Waypoints"] -transform = Transform3D(0.999999, 0.000245532, 0.00101596, -0.000244175, 0.999999, -0.00130966, -0.00101629, 0.00130941, 0.999999, -16.9849, -0.0632343, -9.14554) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -16.985, 0, -9.146) [node name="FliegerBase" type="Node3D" parent="."] @@ -113,9 +113,10 @@ script = ExtResource("2_28a8u") waypoints = [NodePath("../Waypoints/Waypoint1"), NodePath("../Waypoints/Waypoint2"), NodePath("../Waypoints/Waypoint3"), NodePath("../Waypoints/Waypoint4")] [node name="Flieger" type="MeshInstance3D" parent="CharacterBody3D"] -transform = Transform3D(-0.999657, 0, -0.026177, 0, 1, 0, 0.026177, 0, -0.999657, -0.776744, -0.485335, 0.191815) +transform = Transform3D(-0.999657, 0, -0.026177, 0, 1, 0, 0.026177, 0, -0.999657, 0, 0.470388, 0) mesh = ExtResource("3_28a8u") skeleton = NodePath("../..") [node name="CollisionShape3D" type="CollisionShape3D" parent="CharacterBody3D"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.45429, 0) shape = SubResource("BoxShape3D_28a8u")