hello,
i’m new to use effect house.
but i want to make mini shooting games using AR , i was try the ray cast method to detect 3D game object from screen space to world but it never works. can anybody here help me to detect 3D collider or game from screen space to world ?
Certainly! To detect 3D colliders or game objects from screen space to world space in AR:
Set up your AR environment.
Convert screen coordinates to a 3D ray using your AR framework’s methods.
Cast the ray into the 3D scene using raycasting.
Check for collisions with 3D objects, ensuring they have colliders attached.
If you’re using Unity, here’s a simple example in C#:
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out RaycastHit hit)) {
GameObject hitObject = hit.collider.gameObject;
// Handle the hitObject as needed.
}
Make sure to replace Camera.main with your AR camera if it’s different.