Stop the edge sensors from hitting the player's own collider
Since the sensors moved under the EdgeSensors pivot, exclude_parent excludes the pivot rather than the player. With edgeSensorRange equal to the slime's radius the rays start on the edge of its circle and hit it, so edge wraps never triggered. Add the player as an exception. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c212748b8d
commit
ad9e8d62fa
1 changed files with 4 additions and 0 deletions
|
|
@ -92,6 +92,10 @@ func _ready() -> void:
|
|||
leftEdgeSensor.target_position = Vector2(0, sensorDepth)
|
||||
rightEdgeSensor.position = Vector2(edgeSensorRange, 0)
|
||||
rightEdgeSensor.target_position = Vector2(0, sensorDepth)
|
||||
# The sensors' parent is the EdgeSensors pivot, so exclude_parent doesn't
|
||||
# cover us. Without this they can hit our own collider.
|
||||
leftEdgeSensor.add_exception(self)
|
||||
rightEdgeSensor.add_exception(self)
|
||||
|
||||
# Rotates the sprite to sit on the wall or ceiling. Done in _physics_process
|
||||
# (not _process) so physics interpolation smooths it along with our movement.
|
||||
|
|
|
|||
Loading…
Reference in a new issue