Skip to content

Commit

Permalink
demo version
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Bradfield committed Mar 21, 2021
1 parent d244515 commit eb141dc
Show file tree
Hide file tree
Showing 370 changed files with 154,305 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Camera.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
extends Camera

# https://github.com/jocamar/Godot-Post-Process-Outlines

export var lerp_speed = 3.0

export (NodePath) var target_path = null
export (Vector3) var offset = Vector3.ZERO
var target = null

func _ready():
if target_path:
target = get_node(target_path)

func _physics_process(delta):
if !target:
return
var target_pos = target.global_transform.translated(offset)
global_transform = global_transform.interpolate_with(target_pos, lerp_speed * delta)
# var target_pos = target.global_transform.origin + offset
# global_transform.origin = lerp(global_transform.origin, target_pos, lerp_speed * delta)
look_at(target.global_transform.origin, Vector3.UP)
40 changes: 40 additions & 0 deletions Smoke.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[gd_scene load_steps=8 format=2]

[sub_resource type="Gradient" id=1]
offsets = PoolRealArray( 0, 0.348148, 0.992593 )
colors = PoolColorArray( 1, 1, 1, 1, 1, 1, 1, 0.627451, 1, 1, 1, 0 )

[sub_resource type="GradientTexture" id=2]
gradient = SubResource( 1 )

[sub_resource type="Curve" id=8]
_data = [ Vector2( 0, 0.306122 ), 0.0, 0.0, 0, 0, Vector2( 1, 0.766582 ), 0.0, 0.0, 0, 0 ]

[sub_resource type="CurveTexture" id=9]
curve = SubResource( 8 )

[sub_resource type="ParticlesMaterial" id=10]
emission_shape = 2
emission_box_extents = Vector3( 0.2, 0, 0.2 )
direction = Vector3( 0, 0, 0 )
spread = 0.0
gravity = Vector3( 0, 1, 0 )
scale_curve = SubResource( 9 )
color_ramp = SubResource( 2 )

[sub_resource type="SpatialMaterial" id=6]
flags_transparent = true
flags_do_not_receive_shadows = true
vertex_color_use_as_albedo = true

[sub_resource type="SphereMesh" id=7]
material = SubResource( 6 )

[node name="Smoke" type="Particles"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0322643, -0.0968752, 0.119982 )
amount = 10
lifetime = 0.4
speed_scale = 1.6
local_coords = false
process_material = SubResource( 10 )
draw_pass_1 = SubResource( 7 )
10 changes: 10 additions & 0 deletions TestScene.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
extends Spatial


func get_path_direction(position):
var offset = $track_2/Path.curve.get_closest_offset(position)
$track_2/Path/PathFollow.offset = offset
return $track_2/Path/PathFollow.transform.basis.z

func _ready():
print($track_2["transform"])
72 changes: 72 additions & 0 deletions TestScene.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
[gd_scene load_steps=10 format=2]

[ext_resource path="res://tracks/track_2.tscn" type="PackedScene" id=1]
[ext_resource path="res://Camera.gd" type="Script" id=2]
[ext_resource path="res://cars/CarSUV.tscn" type="PackedScene" id=3]
[ext_resource path="res://TestScene.gd" type="Script" id=4]
[ext_resource path="res://lighting_env.tres" type="Environment" id=5]
[ext_resource path="res://cars/carTruck.tscn" type="PackedScene" id=6]
[ext_resource path="res://post_process_outlines.shader" type="Shader" id=7]

[sub_resource type="ShaderMaterial" id=1]
shader = ExtResource( 7 )
shader_param/color_outline_scale = 2.0
shader_param/depth_outline_scale = 2.0
shader_param/depth_threshold = 2.5
shader_param/depth_multiplier = 1000.0
shader_param/edge_threshold = 0.04
shader_param/max_edge_alpha = 0.8
shader_param/edge_alpha_multiplier = 3.0
shader_param/edge_color = Color( 0, 0, 0, 1 )
shader_param/depth_use_laplace = true
shader_param/color_use_laplace = false
shader_param/use_bg_texture = false

[sub_resource type="QuadMesh" id=2]
material = SubResource( 1 )
size = Vector2( 2, 2 )

[node name="TestScene" type="Spatial"]
script = ExtResource( 4 )

[node name="DirectionalLight" type="DirectionalLight" parent="."]
transform = Transform( 1, 0, 0, 0, -0.709866, 0.704337, 0, -0.704337, -0.709866, 0, 83.4295, 0 )
light_energy = 2.0
shadow_enabled = true
shadow_color = Color( 0.6, 0.6, 0.6, 1 )
shadow_contact = 0.34
directional_shadow_mode = 0
directional_shadow_normal_bias = 0.5

[node name="CarSUV" parent="." instance=ExtResource( 3 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 57.089, 0, 5.858 )

[node name="CarMesh" parent="CarSUV" index="0"]
transform = Transform( -1.62921e-07, 0, 1, 0, 1, 0, -1, 0, -1.62921e-07, 0, 0, 0 )

[node name="Camera" type="Camera" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 55.7557, 4.29647, 0 )
current = true
far = 150.0
script = ExtResource( 2 )
target_path = NodePath("../CarSUV/CarMesh")
offset = Vector3( 0, 7, 5 )

[node name="OutlineShader" type="MeshInstance" parent="Camera"]
mesh = SubResource( 2 )
material/0 = null

[node name="track_2" parent="." instance=ExtResource( 1 )]

[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = ExtResource( 5 )

[node name="carTruck" parent="." instance=ExtResource( 6 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -64.1136, 3.12284, -42.5977 )

[node name="CarMesh" parent="carTruck" index="0"]
transform = Transform( 0.0168241, 0, 0.999858, 0, 1, 0, -0.999858, 0, 0.0168241, 0, -3.08592, 0.5 )

[editable path="CarSUV"]

[editable path="carTruck"]
Binary file added assets/kenney_car_kit/_defaultMat.material
Binary file not shown.
Binary file added assets/kenney_car_kit/ambulance.glb
Binary file not shown.
Loading

0 comments on commit eb141dc

Please sign in to comment.