Improve production cockpit realism
This commit is contained in:
1 parent
7613daee84
commit
5455ae7928
9 files changed
+668
-21
No files matched your search
@@ -0,0 +1,67 @@
|
||||
class_name CockpitMeshFactory
|
||||
extends RefCounted
|
||||
|
||||
|
||||
static func add_box(
|
||||
node_name: String,
|
||||
parent: Node3D,
|
||||
position: Vector3,
|
||||
size: Vector3,
|
||||
material: Material,
|
||||
rotation_degrees: Vector3 = Vector3.ZERO
|
||||
) -> MeshInstance3D:
|
||||
var instance := MeshInstance3D.new()
|
||||
instance.name = node_name
|
||||
var mesh := BoxMesh.new()
|
||||
mesh.size = size
|
||||
instance.mesh = mesh
|
||||
instance.material_override = material
|
||||
instance.position = position
|
||||
instance.rotation_degrees = rotation_degrees
|
||||
parent.add_child(instance)
|
||||
return instance
|
||||
|
||||
|
||||
static func add_cylinder(
|
||||
node_name: String,
|
||||
parent: Node3D,
|
||||
position: Vector3,
|
||||
radius: float,
|
||||
height: float,
|
||||
material: Material,
|
||||
rotation_degrees: Vector3 = Vector3.ZERO
|
||||
) -> MeshInstance3D:
|
||||
var instance := MeshInstance3D.new()
|
||||
instance.name = node_name
|
||||
var mesh := CylinderMesh.new()
|
||||
mesh.top_radius = radius
|
||||
mesh.bottom_radius = radius
|
||||
mesh.height = height
|
||||
mesh.radial_segments = 16
|
||||
instance.mesh = mesh
|
||||
instance.material_override = material
|
||||
instance.position = position
|
||||
instance.rotation_degrees = rotation_degrees
|
||||
parent.add_child(instance)
|
||||
return instance
|
||||
|
||||
|
||||
static func add_sphere(
|
||||
node_name: String,
|
||||
parent: Node3D,
|
||||
position: Vector3,
|
||||
radius: float,
|
||||
material: Material
|
||||
) -> MeshInstance3D:
|
||||
var instance := MeshInstance3D.new()
|
||||
instance.name = node_name
|
||||
var mesh := SphereMesh.new()
|
||||
mesh.radius = radius
|
||||
mesh.height = radius * 2.0
|
||||
mesh.radial_segments = 16
|
||||
mesh.rings = 8
|
||||
instance.mesh = mesh
|
||||
instance.material_override = material
|
||||
instance.position = position
|
||||
parent.add_child(instance)
|
||||
return instance
|
||||
Reference in new issue
Block a user