Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | icqqq | |
Old Version | Published before Godot 3 was released. |
Dear all,
I am using a raycast 3d to detect if I am going to a wall.
I want to get the collision normal so that I use get_collision_normal() function.
However, the function sometimes will give me zero Vector, which is (0, 0, 0)
I call the function in _fixed_process() and it seems it return the right normal vector and zero vector interchangeably like the following:
(0, 0, 0)
(-0.5, 0, -0.866025)
(0, 0, 0)
(-0.5, 0, -0.866025)
(0, 0, 0)
(-0.5, 0, -0.866025)
but sometimes it do give me the normal vector continuously like the following:
(-0.5, 0, -0.866025)
(-0.5, 0, -0.866025)
(-0.5, 0, -0.866025)
(-0.5, 0, -0.866025)
(-0.5, 0, -0.866025)
How can I solve the zero vector problem?
Thank you.
Is this Godot 2 or 3? Are you checking that the ray is colliding with is_colliding()
? You could try force_raycast_update()
before any other raycast commands and see if it makes any difference.
mollusca | 2018-01-28 13:33
I am using Godot 2.1.4
And I have checked the ray is colliding with is_colliding()
I have also tried force_raycast_update() but no difference
icqqq | 2018-01-29 13:19