Godot Version
4.3-Stable
Question
Hello. I am making a 3D game, but, I am struggling with connecting the signal I made to another object with the Godot editor. This code can also only connect to the player, which the signal is made in. Not sure if it’s a bug with Godot 4.3, or if I am just doing stuff wrong.I am not sure why, there is a warning the pops up, but I do not know what it means:
W 0:00:00:0699 The signal "sendSig" is declared but never explicitly used in the class.
<GDScript Error>UNUSED_SIGNAL
<GDScript Source>player_script.gd:17
If you need the player code, here is the code:
extends CharacterBody3D
var capMouse : bool = false
var isColliding : bool = false
@export var SPEED = 5.0
@export var JUMP_VELOCITY = 4.5
var look_direction: Vector2
@onready var camera = $Camera3D
@onready var toolRayCast = $Camera3D/Tool/RayCast3D
var cam_sense = 50
signal sendSig
func _physics_process(delta: float) -> void:
Movement()
GravityAndJump(delta)
InteractionCollision()
PauseMouse()
QUIT()
RotateCamera(delta , 0.5)
move_and_slide()
#if (isColliding == true):
#print("Yes")
#elif (isColliding == false):
#print("No")
func _input(event: InputEvent) -> void:
if event is InputEventMouseMotion:
look_direction = event.relative * 0.01
func RotateCamera(delta: float , sense_mod : float):
var input = Input.get_vector("ui_left" , "ui_right" , "ui_down" , "ui_up")
look_direction += input
rotation.y -= look_direction.x * cam_sense * delta
camera.rotation.x = clamp(camera.rotation.x - look_direction.y * cam_sense * sense_mod * delta , -1.5 , 1.5)
look_direction = Vector2.ZERO
func InteractionCollision():
if (toolRayCast.is_colliding()):
var collider = toolRayCast.get_collider()
if (collider.name == "RepairObject"):
isColliding = true
if (Input.is_action_just_pressed("interact")):
pass
elif (!collider.name == "RepairObject"):
pass
else:
isColliding = false
func Movement():
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var input_dir := Input.get_vector("left", "right", "up", "down")
var direction := (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
if direction:
velocity.x = direction.x * SPEED
velocity.z = direction.z * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
velocity.z = move_toward(velocity.z, 0, SPEED)
func GravityAndJump(delta):
# Add the gravity.
if not is_on_floor():
velocity += get_gravity() * delta
# Handle jump.
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
velocity.y = JUMP_VELOCITY
func PauseMouse():
if (Input.is_action_just_pressed("pause")):
capMouse = !capMouse
if (capMouse == true):
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
else:
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
func QUIT():
if (Input.is_action_just_pressed("quit")):
get_tree().quit()
func _on_ready() -> void:
emit_signal("sendSig")
Help is gladly appreciated