feat(*): Add orientation-readable team-coloured ship meshes, smooth the ball-cam orbit, and hide arena walls the camera is outside of

This commit is contained in:
Josh Creek
2026-07-19 22:18:21 +01:00
parent dfb7285704
commit 4f075b352f
5 changed files with 171 additions and 52 deletions
+30 -1
View File
@@ -19,8 +19,18 @@ extends RigidBody3D
@export var drag_coefficient = 0.98 # Linear drag (air resistance)
@export var angular_drag = 0.95 # Rotational drag
# Accent colours per team, applied to the nose and tail fin meshes so the
# two sides are tellable apart at a glance.
const TEAM_COLORS := {
0: Color(0.25, 0.55, 1.0),
1: Color(1.0, 0.5, 0.15),
}
# Which team this ship plays for (0 or 1). Set by the game mode on spawn.
var team: int = 0
var team: int = 0:
set(value):
team = value
_apply_team_color()
var controller: ShipController
var _current_action: ShipAction = ShipAction.new()
@@ -62,6 +72,25 @@ func _ready():
controller = child
break
_apply_team_color()
func _apply_team_color() -> void:
if not is_inside_tree():
return
var color: Color = TEAM_COLORS.get(team, TEAM_COLORS[0])
var accent := StandardMaterial3D.new()
accent.albedo_color = color
accent.metallic = 0.3
accent.roughness = 0.5
accent.emission_enabled = true
accent.emission = color
accent.emission_energy_multiplier = 0.35
for mesh_name in ["Nose", "TailFin"]:
var mesh := get_node_or_null(mesh_name) as MeshInstance3D
if mesh:
mesh.material_override = accent
# Attach the node that drives this ship (player, AI, or network). Replaces
# any existing controller; parents the new one under the ship if needed.