Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / 3D Physics Raycast, get all hit objects?

Author
Message
MMT
3
Years of Service
User Offline
Joined: 12th Mar 2018
Location:
Posted: 2nd Jan 2021 15:07
Happy new year!

Is there a way to iterate through all the objects in 3D Physics that are hit by the raycast?

In normal 3D you can iterate through them, but somehow I don't see that possibility here... or have I gone blind.

Greetings
jd_zoo
3
Years of Service
User Offline
Joined: 12th May 2018
Location: Nova Scotia
Posted: 2nd Jan 2021 17:18 Edited at: 2nd Jan 2021 17:38
EDIT - sorry this is bad info below, I was thinking sphere (slide) cast. Raycast seems to just stop at first collision...

Not sure if this is what you are looking for, but setting the Object ID to 0 when doing the raycast will go through all the objects and not just return the first one it hits.

ObjectRayCast(objID = 0, ...)

Then you get this data:
GetObjectRayCastNumHits -> tells you how many hits the last raycast had in the last check

And you can go through the different IDs to look for your object:
GetObjectRayCastHitID -> Returns the object ID at the index for the cast hits

Login to post a reply

Server time is: 2021-09-25 16:01:32
Your offset time is: 2021-09-25 16:01:32