Hi,
I have a RayCast3D attached to my characters first person head. How do I get the end point of the RayCast3D when it doesn't collide with anything, in global coordinates? The RayCast3D moves with the head. It is used to check if the player hit the target with his gun.
Thank you!
https://docs.godotengine.org/en/stable/classes/class_raycast.html#class-raycast-method-get-collision-point
raycastNode.get_collision_point( )
if using intersect_ray() you declare it and then use intersectingRay.position
Lethn That method doesn't give sensible data when the Ray isn't colliding with anything. My use case is that if the player looks into the sky, the bullets should still go to where the end of the ray is. I need to find the end point of the ray when it is NOT colliding with anything. get_collision_point() returns (0, 0, 0) if that is the case.
gowner Ah, in that case the common trick is to create an invisible wall for your ray to shoot at, you're still physically colliding with something but as far as the player is concerned they're shooting off into the distance and sorry, didn't properly read your OP and thought you were just asking about getting raycast data.
Lethn Hey, we solved it by putting an empty Node3D (we're using 4) at the end of the ray and using its global_position. This way, we don't have to play around with collision layers and stuff like that.
Thanks for your idea though!
gowner That's clever! I hadn't thought of that.