Problems with Raycasts [Solved]

I am trying to make a raycasting system in my game to make an interaction sytem. What im trying to do is send 2 raycasts from the players position in the player direction and see if there are Interactable objects or Collision objects that the raycasts hit. I dont know why it doesnt work. In the game the only interactable object is the Red Button on a stand. The example doesnt really work with mobile. The Crosshair is supposed to go red when the Player’s raycast is hitting the Interactables and the Collisions, and the CrossHair is supposed to go green with hitting Interactables and not hitting Collisions

There’s a raycast extension for 3D. Have you tried it?

I wanted to make a 2d version first so i know what to do for the 3d version

I don’t know how 3D objects interact with the 2D raycast. I don’t have much experience in the 3D realm.

I remember a project in the past. When they used the 2D raycast it was selecting all of the object in the same column. I think because in a 2D coordinate system the 3D objects are all basically ln the ground. I could be wrong. Their solution was the 3D raycast.

https://forum.gdevelop.io/t/cast-a-ray-does-not-work-on-ipad/52706

The raycasts are in the same event. So, the 2nd ray cast can’t happen unless the first is true. And bc your number of picked isn’t a sub event of the ray cast. The picked number will always be 1 as long as it triggers that events based on the distance check.

I don’t believe the collision picked will ever change.