diff --git a/scenes/base_track_level.gd b/scenes/base_track_level.gd index f6c0c5c..76683d4 100644 --- a/scenes/base_track_level.gd +++ b/scenes/base_track_level.gd @@ -27,8 +27,13 @@ func spawn_player(player_node: Node, gui: Node) -> void: func reset_player_to(node_to_reset_to: Node, player_node: BuggedVehicle) -> void: - player_node.reset_transform = node_to_reset_to.global_transform - player_node.reset_transform.origin += node_to_reset_to.global_transform.basis.y * 15 + player_node.reset_transform = node_to_reset_to.global_transform.looking_at( + node_to_reset_to.global_transform.translated( + node_to_reset_to.global_transform.basis.z + ).origin, + node_to_reset_to.global_transform.basis.y + ) + player_node.reset_transform.origin += node_to_reset_to.global_transform.basis.y * 5 func _on_ResetArea_body_entered(body: Node) -> void: diff --git a/vehicles/vehicle.gd b/vehicles/vehicle.gd index e9ed7f8..555a564 100644 --- a/vehicles/vehicle.gd +++ b/vehicles/vehicle.gd @@ -71,6 +71,8 @@ func _ready(): func _integrate_forces(state: PhysicsDirectBodyState) -> void: if reset_transform != Transform.IDENTITY: state.set_transform(reset_transform) + state.linear_velocity = Vector3.ZERO + state.angular_velocity = Vector3.ZERO reset_transform = Transform.IDENTITY