Hello, i'm working on a IA for a enemy, and i have a problem that blows my mind with raycasts.
For some reason, my RayCast isn't colliding with anything, i have tried with both bodys and areas checked and it doesn't collide.
Yes, i'm aware that RayCast info is only updated per physics frame, i'm forcing the raycast's update when needed. This is my code.
Vector3 rotation = this.LeftRay.Rotation;
Vector3 castto= this.LeftRay.CastTo;
this.LeftRay.CastTo = new Vector3(position.x,position.y,position.z+this.LeftRay.Translation.z);
this.LeftRay.Rotation = new Vector3(0,0,0);
this.LeftRay.ForceRaycastUpdate();
GD.Print(this.LeftRay.CastTo);
if(this.LeftRay.IsColliding()){
toreturn = true;
}
this.LeftRay.CastTo = castto;
this.LeftRay.Rotation = rotation;
this.LeftRay.ForceRaycastUpdate();
This is code for a collision checker, it checks if there's a collision between the enemy and a given position, LeftRay is the Ray's node, and position is the given position, in Vector3.
I'm using c# but i think is very easy to translate to GDScript if you aren't familiar with c#.
Thanks! Sorry for my bad english.
edit: i'm actually using godot 3.2.3 mono, not 3.3.3 mono.