Cast a ray does not work on ipad

This code works well in windows on a desktop. But it is not working on an ipad? None of the Actions get activated.

Works on my other game:

In the game that works, do you have the 2 result parameters filled in? Or are they left empty like you have in the screen shot? I’m just wondering if that is causing an issue.

in both they are not filled in

In level 1 of the game, the ray casting is working somewhat, but on level 3, the ray casting deletes more that one object at a time. Any suggestions?

I think I know what’s going on. When a ray is cast, i think it casts one pixel ray from the top of the screen to the bottom. When the objects are moving and then are lined up vertically, both that are on the ray get deleted.

I thought if I made sure the Y axis of all the objects were not equal, then the one object could be deleted. Didn’t work??? I think the ray cast is the width of the object, ie. 100 pixels wide from the top of the screen to the bottom.

It looks like it’s being triggered twice because the score is increasing by 20 not 10. If it was deleting multiple objects at the same time the score would only change by 10. Are there other events doing the same thing?

I tried to make boundaries for the objects that are above or below object that I want to delete. Didn’t work???

It seems to only be deleting 1 object at a time but either this event is being triggered more than once or there are other events doing the same as these events. The conditions plus the trigger once should prevent this event from triggering multiple times. Do you have other similar events?

If this event was only triggered once then the score would only change by 10 points not 20.

Yes. The above code is for one duck, there are 3 more code blocks similar to this one.

I think it has to do with the touch or left mouse button is down and then I don’t have a Touch or left mouse released command???

Do the other blocks use the same object names? This one could trigger then one of the others could also trigger. And so on. Each event group runs independently.

Different objects with different names.

I tried this, without success.

1 Like

Try putting a debug action after the mouse is down to see if it’s being triggered twice.


The trigger once should prevent it from shooting twice. Are you changing the visibility status of the curso01 object? That condition is also figured into the trigger once condition.

I added trigger once and it still deleted two objects at the same time.

I am trying to set up 3 can targets with one on top of two others. Same thing is happening. They get deleted one at a time, no problem, when they are side by side and not touching.

I added the line of code about the visibility because i seen someone else online use it, don’t know if i need that line at all?

The visibility is only an issue if the visibility is being changed. If the visibility gets changed, it would reset the trigger once allowing multiple triggers. That’s the only reason I asked about it. Are there any events to hide/show the cursor object.

I still think either that event group is being triggered multiple times or there’s another event that’s also being triggered.

Did you try adding the debug line to the event that deletes the objects to see if the event is being triggered multiple times. That would tell you if it was that group being triggered once or multiple times.

If you’re still stuck, you can either post screenshots of more of the related events. Anything that controls the cursor image or mentions the object being deleted. Or you could share a link to your project on a file sharing site.

The only other reference to the Cursor1 is:


I removed all the if Cursor1 is visible code.

Seems to work better.

I realized that the x and y positions of the ray cast is different from the x and y positions of the cans. So I put the x y and z positions of the can that the ray is on to see which one to delete. Works sometimes.

PS I combined levels one, two and three. There is only one level now.

OK. I think there’s also a 3D Raycast behavior, I’ve never used it. I have very little experience with the 3D environment.