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.

3 Dimensional Chat / [SOLVED] How to raytrace with collision detection?

Years of Service
User Offline
Joined: 3rd Feb 2016
Posted: 5th Aug 2018 00:32
This is a script i found the internet. It works fine and returnd the coordinates in 3D of where my mouse is pointing at 1024 units away.
But what if there is a wall in front of me a few units away how can i get coordinates of the 3d mouse clipping in the wall? I couldn't find an example specifically showing this.
Here is the code i am using right now for tier 2:

The author of this post has marked a post as an answer.

Go to answer

Valued Member
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 5th Aug 2018 16:52
This post has been marked by the post author as the answer.
raycast from your position to the returned co-ords then use
// get the ray cast intersect point
intersect_x# = GetObjectRayCastX(0)
intersect_y# = GetObjectRayCastY(0)
intersect_z# = GetObjectRayCastZ(0)
to find the point of impact
you will want to check you actually hit something first by checking your raycast is greater than 0 though
life's one big game
spec= 4ghz, 16gb ram, AMD R9 2700 gpu
Years of Service
User Offline
Joined: 3rd Feb 2016
Posted: 7th Aug 2018 16:04
Thanks for the help i got it fully working now!

Login to post a reply

Server time is: 2023-09-21 08:59:16
Your offset time is: 2023-09-21 08:59:16