Scripts / Just wondering...

Author
Message
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 14th Mar 2021 23:21 Edited at: 15th Mar 2021 00:50
Anyone have any idea what this function is used for?
GetIntersectCollisionNX() -- returns the X normal of the entity hit surface

I just get a number between 0 and 1 and occasionally negative. To see if AI or player is near a transparent like a window... Any way to detect difference of regular and transparent surfaces on same objects? I have changed the normals on a test object and smoothed it out, but I still getting anomalies that appear from some unknown source... ?
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 15th Mar 2021 09:01
Goes with the others (i.e. Y & Z) to give you the Normal vector at the Ray cast intersection point I would assume.

Of what earthly use that information could be I have no opinion.
Been there, done that, got all the T-Shirts!
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 15th Mar 2021 09:52 Edited at: 15th Mar 2021 09:55
you use it with the intersect point of the ray cast so you can get the direction of the reflect for the ray based on the angle of the surface hit.
i.e. intersect point x / y / z + intersect normal x / y / z = new position & direction of reflect away from the surface hit
useful for lining up things like bullet holes on surfaces (assuming you can rotate to a world co-ord) or making fake physics bounce in the correct direction
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Attachments

Login to view attachments
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 15th Mar 2021 16:47
Does it work off of the visible object or the physics shape?

i.e. if the point of contact is on a smoothing group on say a cylinder that actually has box collision shape what do you get, the normal from the curved visible surface or the normal from the flat box shape?
Been there, done that, got all the T-Shirts!
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 15th Mar 2021 16:55
So getting angles of surfaces? I guess that would be pretty handy at some point.
Then that makes sense with the numbers given when I passed over a curved surface.
Was hoping empty normals could be detected from filled normals-- or actually color (_D) vs transparency
which would have humongous value, extraordinary implications and otherworldly, multidimensional uses.
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 15th Mar 2021 20:32
Quote: "Does it work off of the visible object or the physics shape?
i.e. if the point of contact is on a smoothing group on say a cylinder that actually has box collision shape what do you get, the normal from the curved visible surface or the normal from the flat box shape?"

it returns what the ray cast hits which seems to be the actual mesh rather than a physics shape from what i have seen.

Quote: "Was hoping empty normals could be detected from filled normals-- or actually color (_D) vs transparency
which would have humongous value, extraordinary implications and otherworldly, multidimensional uses."

no it won't return the transparency value of a texture, that would be a shader call... it's possible but if there's a way to do that in GG i have no idea
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 15th Mar 2021 22:08
If transparency value is stated in the fpe file, then the file might be read via Lua code to get that value, though.
Does the raycast collide when hits a transparent zone of the model?
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 16th Mar 2021 02:00
"Does the raycast collide when hits a transparent zone of the model? "
Yes, unfortunately. Or- at least I tried this with a simple erase region of the _D (color), then a Normals,
and maybe _S.
Detecting this difference is where the power would come into play- not just reading the one texture.
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 16th Mar 2021 09:16
Doing a deep dive on the code it appears the 'normal' returned is the 'reflected normal', so to get the surface normal (for placing bullet holes for example) you would need to calculate the inverse of the ray vector and subtract the reflected normal vector.

The interesting thing there is that you could in theory use this for ricochets.

i.e. cast a ray from the impact point along the reflected vector for a short distance and see if it hits anything.
Been there, done that, got all the T-Shirts!
PM

Login to post a reply

Server time is: 2024-12-22 01:57:24
Your offset time is: 2024-12-22 01:57:24