And how do I use them? I know ray sensors sends a ray directly infront but that won’t be enough if I wanted to give an enemy “cone vision” so can someone explain to me how the other functions work so that I can better use them. Thanks
The best way is to look a the Blender API documentation. It explain what attributes and functions are available at each object.
Finally rays are not send. A ray cast is an measure method to detect when an imaginary line (called ray) crosses faces of existing meshes.
The ray sensor does exactly that. The measure will be along one of the 6 local axis of the owning object. This is simple to setup, is constantly measuring and sufficient in most cases.
When you need to detect along another “ray” you can use rayCast. You provide two points in space to describe the start and endpoint of the imaginary line.
As a special form (because it is an usual use case) you can use rayCastTo. The start point is the position of the object you call this from. You need to specify the endpoint as you would with rayCast.
Be aware both function deliver a - in my eyes confusing - container of various different values. You need to check the API to find out what they mean.
Thank you for the response, the API describe rayCastTo “(Acts like a laser beam trip wire between one object and an object/position.)”, what I’d like to know is that if there is a way to change it to a wall of beam instead of a thin wire between the objects? Like a spot lamp maybe? And this probably won’t work but is there a way for spot lamp to detect and return the object it hits like the ray?(I think everyone will already be using it if it does…)