very simple hologram positioning code put on gist for no real reason
Last active
February 3, 2022 17:48
-
-
Save Divran/3814d65f50164fa8a7c6cd4bac1712eb to your computer and use it in GitHub Desktop.
holo corners
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@name holo corners | |
local E = entity():isWeldedTo() | |
local Min = E:aabbMin() | |
local Max = E:aabbMax() | |
local Size = Max-Min | |
local Center = (Max+Min)/2 | |
local A = ang() | |
#make slightly transparent for testing | |
E:setAlpha(150) | |
local Sides = array( | |
vec(1,0,-1), | |
vec(-1,0,-1), | |
vec(1,0,1), | |
vec(-1,0,1), | |
vec(0,1,-1), | |
vec(0,-1,-1), | |
vec(0,1,1), | |
vec(0,-1,1), | |
vec(1,1,0), | |
vec(1,-1,0), | |
vec(-1,1,0), | |
vec(-1,-1,0) | |
) | |
for(I=1,Sides:count()) { | |
local Side = Sides[I,vector] | |
holoCreate(I,E:toWorld(Center+Size*Side*0.5)) | |
holoAng(I,E:toWorld(A)) | |
local Scale = vec( | |
Side:x()==0 ? Size:x() : 0.5, | |
Side:y()==0 ? Size:y() : 0.5, | |
Side:z()==0 ? Size:z() : 0.5 | |
) | |
holoScale(I,Scale/12) | |
holoParent(I,E) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment