I have a area node in godot4 which can scale up and down and also rotate. there are celling, floor and wall in scene, my area node place between them and can scale up, when this area got bigger can collide with other areas like floor, wall or celling. I want to know that area i collided is wall, floor or celling. I know there is characterbody node which has method that shows node which is collided is wall, floor or ceiling. but I want to use area node for both of them. how can I find node which is collided is wall, celling or floor? Thanks in advance.
this is my code: func my_raycast(myray:RayCast3D,myarea:Area3D): myray.global_position = center_pivot.global_position myray.enabled = true
myray.target_position = myarea.global_position - myray.global_position
if(myray.is_colliding()):
if(myray.get_collider().name==myarea.name):
#myray.enabled = false
print("colided")
var mynormal = myray.get_collision_normal()
print(myray.get_collision_normal())
if(mynormal.is_zero_approx()):
mynormal = -myray.global_position.direction_to(myray.to_global(myray.target_position))
var is_floor:bool = mynormal.angle_to(myarea.transform.basis.y/myarea.scale.y) <= PI/4
var is_ceiling:bool = mynormal.angle_to(myarea.transform.basis.y/myarea.scale.y) <= PI/4
var is_wall:bool = mynormal.angle_to(myarea.transform.basis.y/myarea.scale.y) <= PI/4
=============== never condition of is_zero_approx got true.
I used raycast for finding normal of node I collided but I don't have any idea, how to find answer? I don't want to use layer or tags on wall, floor and celling @Theorat