Hello everybody, I have an issue with a ShapeCast3D not detecting my player character (it is controlled by a script that inherits from CharacterBody3D).
I have a “sight” function that checks the collision result of the ShapeCast3D to update a target variable and it is not detecting my player. Curiously, I was calling that sight function from _Process and changed it to _PhysicsProcess and it worked!.. but only for a while. Now, is broken again (still called by _PhysicsProcess).
I guess it is somehow related to that my player is controlled, but I can’t figure out what to do. Have you ever had this issue?
I don’t think so… It didn’t work at the beginning and then I moved the call to that function from _Process to _PhysicsProcess in the class that calls it, and it worked. I don’t understand why. But after keep working on several code parts it stopped working… Then I moved back this function call to _Process just in case, and nothing again.
My code structure is simple:
Enemy class has a AIPerception component, which contains a reference to the ShapeCast3D and has the function I shared.
It’s worth to mention that this code works fine detecting a dummy CharacterBody3D I created to test:
The script DummyTarget contains is very simple, it is basically a script that inherits from ITarget because that is the class my Sight function looks for.
Dummy and real player are both in the same Collision layer.
Well physics-calculation should always be on _physicsProcess. ForceShapeCastUpdate should also not be necessary.
And you are sure it is in range of the shapecast?