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 Classic Chat / Does GetObjectRayCastX() return where the radius was hit for ObjectSphereCast()?

Author
Message
Golelorn
8
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 16th Mar 2020 23:51 Edited at: 17th Mar 2020 00:04
My coordinates are not on the mesh. You can see I place the boxes at the spot that GetObjectRayCastX/Y/Z return, but its not near the mesh. I am trying to add an avoidance force for walls. But I believe my collisions hits are incorrect. It works for avoiding the other cylinders perfectly, but I just use their position not collision detection.

Is there a way to return where the collision is on the mesh? Or am I doing something wrong in my code below? Thank you.

Thanks.



Attachments

Login to view attachments
Mesher
User Banned
Posted: 17th Mar 2020 00:14
SetObjectShape = polygon

Golelorn
8
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 17th Mar 2020 00:50
I believe that is a 3D Physics command. While, I would love to just use those commands, in my experience they are finicky, and we lack the proper documentation to use it in an entire project.

Also, I am already knee deep in vector math, so I might as well go all the way.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 17th Mar 2020 02:02 Edited at: 17th Mar 2020 07:14
Taking the example from the documentation, it appears to return the center of the sphere that collides with the object.
You can find the contact point using GetObjectRaycastX/Y/Z() and GetObjectRaycastNormalX/Y/Z() to cast a ray through the original collision object.

As far as i can see (and i can't see very far) the normals point in the OPPOSITE direction to the contact. So if you use SetObjectLookAt() to look along the normals it will look in the opposite direction.
Not sure if you have to flip them when casting a ray.

nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 18th Mar 2020 21:50
If you are still stuck with this, I've made a routine for my VR lib which places a glow decal on the correct point, at the correct angle on the object face (like the laser pointer you see in VR stuff)

Login to post a reply

Server time is: 2024-11-22 05:20:00
Your offset time is: 2024-11-22 05:20:00