Manually spawn weapons fixed
Pop the world weapon scene into weaponcontainer
This commit is contained in:
@@ -14,6 +14,8 @@ var _pickup_area: Area3D = null
|
||||
var _is_being_picked_up: bool = false
|
||||
|
||||
func _ready():
|
||||
print("[WorldWeapon ", name, "] _ready() called. weapon_id=", weapon_id, ", weapon_data=", weapon_data)
|
||||
|
||||
# Set collision layer to "weapon" (layer 3 = bit 4)
|
||||
collision_layer = 4
|
||||
collision_mask = 2 # Collide with world
|
||||
@@ -21,10 +23,14 @@ func _ready():
|
||||
# Set up physics
|
||||
if weapon_data:
|
||||
mass = weapon_data.weight
|
||||
print("[WorldWeapon ", name, "] Set mass to ", mass)
|
||||
|
||||
# Spawn mesh
|
||||
if weapon_data and weapon_data.mesh_scene:
|
||||
print("[WorldWeapon ", name, "] Spawning mesh from ", weapon_data.mesh_scene)
|
||||
_spawn_mesh()
|
||||
else:
|
||||
print("[WorldWeapon ", name, "] ERROR: Cannot spawn mesh. weapon_data=", weapon_data, ", mesh_scene=", weapon_data.mesh_scene if weapon_data else "null")
|
||||
|
||||
# Create collision shape if not exists
|
||||
_setup_collision()
|
||||
@@ -44,6 +50,7 @@ func _spawn_mesh():
|
||||
# Instantiate mesh
|
||||
_mesh_instance = weapon_data.mesh_scene.instantiate()
|
||||
add_child(_mesh_instance)
|
||||
print("[WorldWeapon ", name, "] Mesh spawned successfully: ", _mesh_instance)
|
||||
|
||||
func _setup_collision():
|
||||
# Check if we already have a collision shape
|
||||
|
||||
Reference in New Issue
Block a user