Terrain parameters includes bounce override

This commit is contained in:
Rob Kelly 2025-01-09 11:08:50 -07:00
parent c699a72578
commit cf185592d6
5 changed files with 24 additions and 4 deletions

BIN
levels/debug_level/terrain_assets.res (Stored with Git LFS)

Binary file not shown.

View File

@ -153,6 +153,7 @@ func _integrate_forces(state: PhysicsDirectBodyState3D) -> void:
_surface_time_s = 0.0 _surface_time_s = 0.0
var params := terrain_physics.get_params(_surface_terrain) var params := terrain_physics.get_params(_surface_terrain)
#physics_material_override.bounce = params.bounce
angular_damp = params.angular_damp angular_damp = params.angular_damp
linear_damp = params.linear_damp linear_damp = params.linear_damp
@ -174,6 +175,8 @@ func _physics_process(delta: float) -> void:
_shot_time_s += delta _shot_time_s += delta
_surface_time_s += delta _surface_time_s += delta
physics_material_override.bounce = terrain_physics.get_params(_surface_terrain).bounce
func enter_zone(zone: BallZone) -> void: func enter_zone(zone: BallZone) -> void:
_zones.push_back(zone) _zones.push_back(zone)

View File

@ -7,51 +7,61 @@
script = ExtResource("1_45pis") script = ExtResource("1_45pis")
linear_damp = 1.15 linear_damp = 1.15
angular_damp = 3.0 angular_damp = 3.0
bounce = 0.9
[sub_resource type="Resource" id="Resource_3k63c"] [sub_resource type="Resource" id="Resource_3k63c"]
script = ExtResource("1_45pis") script = ExtResource("1_45pis")
linear_damp = 0.0 linear_damp = 0.0
angular_damp = 0.0 angular_damp = 0.0
bounce = 0.5
[sub_resource type="Resource" id="Resource_xf73q"] [sub_resource type="Resource" id="Resource_xf73q"]
script = ExtResource("1_45pis") script = ExtResource("1_45pis")
linear_damp = 4.4 linear_damp = 4.4
angular_damp = 4.0 angular_damp = 4.0
bounce = 0.4
[sub_resource type="Resource" id="Resource_nhn3l"] [sub_resource type="Resource" id="Resource_nhn3l"]
script = ExtResource("1_45pis") script = ExtResource("1_45pis")
linear_damp = 0.86 linear_damp = 0.86
angular_damp = 1.0 angular_damp = 1.0
bounce = 0.9
[sub_resource type="Resource" id="Resource_m3wjo"] [sub_resource type="Resource" id="Resource_m3wjo"]
script = ExtResource("1_45pis") script = ExtResource("1_45pis")
linear_damp = 2.3 linear_damp = 2.3
angular_damp = 4.0 angular_damp = 4.0
bounce = 0.4
[sub_resource type="Resource" id="Resource_h4rld"] [sub_resource type="Resource" id="Resource_h4rld"]
script = ExtResource("1_45pis") script = ExtResource("1_45pis")
linear_damp = 1.62 linear_damp = 1.62
angular_damp = 1.0 angular_damp = 1.0
bounce = 0.9
[sub_resource type="Resource" id="Resource_j6lib"] [sub_resource type="Resource" id="Resource_j6lib"]
script = ExtResource("1_45pis") script = ExtResource("1_45pis")
linear_damp = 4.7 linear_damp = 4.7
angular_damp = 2.0 angular_damp = 2.0
bounce = 0.6
[sub_resource type="Resource" id="Resource_7f7ql"] [sub_resource type="Resource" id="Resource_7f7ql"]
script = ExtResource("1_45pis") script = ExtResource("1_45pis")
linear_damp = 7.6 linear_damp = 7.6
angular_damp = 4.0 angular_damp = 4.0
bounce = 0.3
[sub_resource type="Resource" id="Resource_pusmf"] [sub_resource type="Resource" id="Resource_pusmf"]
script = ExtResource("1_45pis") script = ExtResource("1_45pis")
linear_damp = 12.0 linear_damp = 12.0
angular_damp = 32.0 angular_damp = 32.0
bounce = 0.0
[sub_resource type="Resource" id="Resource_edkxb"] [sub_resource type="Resource" id="Resource_edkxb"]
script = ExtResource("1_45pis") script = ExtResource("1_45pis")
linear_damp = 1.55 linear_damp = 1.55
angular_damp = 1.3 angular_damp = 1.3
bounce = 0.8
[resource] [resource]
script = ExtResource("2_yuehx") script = ExtResource("2_yuehx")

View File

@ -1,7 +1,6 @@
[gd_scene load_steps=26 format=3 uid="uid://dfttci386ohip"] [gd_scene load_steps=26 format=3 uid="uid://dfttci386ohip"]
[ext_resource type="Script" path="res://src/equipment/balls/physics_ball/game_ball.gd" id="1_iwh2u"] [ext_resource type="Script" path="res://src/equipment/balls/physics_ball/game_ball.gd" id="1_iwh2u"]
[ext_resource type="PhysicsMaterial" uid="uid://3bih72l068ic" path="res://src/equipment/balls/physics_ball/normal_physics.tres" id="1_l23pw"]
[ext_resource type="Resource" uid="uid://c6tt1hto75ex4" path="res://src/equipment/balls/physics_ball/normal_terrain_physics.tres" id="3_3gnie"] [ext_resource type="Resource" uid="uid://c6tt1hto75ex4" path="res://src/equipment/balls/physics_ball/normal_terrain_physics.tres" id="3_3gnie"]
[ext_resource type="Material" uid="uid://dpsmjlhjpc7vs" path="res://assets/materials/basic_ball_material.tres" id="3_rc7m1"] [ext_resource type="Material" uid="uid://dpsmjlhjpc7vs" path="res://assets/materials/basic_ball_material.tres" id="3_rc7m1"]
[ext_resource type="Script" path="res://src/equipment/balls/physics_ball/ball_sfx.gd" id="5_bhshl"] [ext_resource type="Script" path="res://src/equipment/balls/physics_ball/ball_sfx.gd" id="5_bhshl"]
@ -16,6 +15,9 @@
[ext_resource type="Texture2D" uid="uid://c47bkx508biqr" path="res://assets/sprites/particles/plasma.png" id="12_guipt"] [ext_resource type="Texture2D" uid="uid://c47bkx508biqr" path="res://assets/sprites/particles/plasma.png" id="12_guipt"]
[ext_resource type="PackedScene" uid="uid://cm4bb3lg4mfd2" path="res://src/world/effects/splash/splash_effect.tscn" id="12_qlrvx"] [ext_resource type="PackedScene" uid="uid://cm4bb3lg4mfd2" path="res://src/world/effects/splash/splash_effect.tscn" id="12_qlrvx"]
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_u134x"]
bounce = 0.4
[sub_resource type="SphereMesh" id="SphereMesh_y0d13"] [sub_resource type="SphereMesh" id="SphereMesh_y0d13"]
material = ExtResource("3_rc7m1") material = ExtResource("3_rc7m1")
radius = 0.05 radius = 0.05
@ -132,7 +134,7 @@ size = Vector2(0.2, 0.2)
[node name="PhysicsBall" type="RigidBody3D"] [node name="PhysicsBall" type="RigidBody3D"]
mass = 0.05 mass = 0.05
physics_material_override = ExtResource("1_l23pw") physics_material_override = SubResource("PhysicsMaterial_u134x")
sleeping = true sleeping = true
freeze = true freeze = true
continuous_cd = true continuous_cd = true

View File

@ -1,5 +1,10 @@
class_name TerrainParameters extends Resource class_name TerrainParameters extends Resource
## Physical parameters for an individual terrain type. ## Physical parameters for an individual terrain type.
## Linear damping applied while in contact with the terrain surface.
@export var linear_damp := 0.0 @export var linear_damp := 0.0
## Angular damping applied while in contact with the terrain surface.
@export var angular_damp := 0.0 @export var angular_damp := 0.0
## Physical bounciness of the terrain. Use this instead of the physics material override.
@export var bounce := 0.0