• Any way to tell if an entity (or vector) is inside the skybox?
    9 replies, posted
Title is self explanatory. Need to know if there is a way to detect if something is inside the skybox.
If you mean in the world, [url]https://wiki.garrysmod.com/page/util/IsInWorld[/url] Took me 2 googles ;)
[QUOTE=tzahush;52188946]If you mean in the world, [url]https://wiki.garrysmod.com/page/util/IsInWorld[/url] Took me 2 googles ;)[/QUOTE] Thanks but I already knew this existed and was not what I intended. I need to know if something is in the skybox area (not necessarily inside the world)
probably use coordinates
I think he means the 3d skybox, and you would probably have to do something with sky_camera
[QUOTE=rtm516;52189205]I think he means the 3d skybox, and you would probably have to do something with sky_camera[/QUOTE] send out traces which only hit world geometry where those traces hit will be the bounds of the 3d skybox
[QUOTE=mdeceiver79;52189211]send out traces which only hit world geometry where those traces hit will be the bounds of the 3d skybox[/QUOTE] Correct me if I am wrong but surely the traces would still hit normal worldspawn and not only the 3D skybox area?
[QUOTE=Sm63;52189439]Correct me if I am wrong but surely the traces would still hit normal worldspawn and not only the 3D skybox area?[/QUOTE] sorry i meant send traces out from the skybox camera
if you only need this for one map, manually define the bounds yourself using something like the example provided here. [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Vector/WithinAABox]Vector:WithinAABox[/url]
[QUOTE=Z0mb1n3;48628854]I'm using the entity's :GetSaveTable().scale to retrieve it scale EDIT: Here you guys go, this seems to work just fine now. I whipped up a function to translate a position to the skybox. [code] function util.WorldToSkybox(pos) local campos local skyscale = 1 for k,v in pairs(ents.FindByClass("sky_camera")) do campos = v:GetPos() skyscale = v:GetSaveTable().scale end local offset = pos/skyscale return campos+offset end [/code] EDIT2: Well you know, I figure, might as well have a way to convert a skybox position into the world, so here you go, too. [code] function util.SkyboxToWorld(pos) local skyscale = 1 local campos for k,v in pairs(ents.FindByClass("sky_camera")) do skyscale = v:GetSaveTable().scale campos = v:GetPos() end local offset = (pos-campos)*skyscale return Vector(0,0,0)+offset end [/code] Maybe these could be made standard functions? They seem useful enough.[/QUOTE]
Sorry, you need to Log In to post a reply to this thread.