Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name TraceDisplay
- @inputs [Display]:wirelink
- @outputs [D F]:number [C]:entity
- @persist [E]:entity [H J P R Resolution S]:number
- if(dupefinished())
- {
- reset()
- }
- if(first())
- {
- #Configurables
- Resolution = 16
- Scale = 250
- #More variables
- R = Resolution * Resolution - 1
- S = Scale / Resolution
- P = 0
- #Initialize the digital screen
- Display[1048574] = 0 #Reset Screen and whatever was on it will be cleared.
- Display[1048569] = 3 #Set color mode to 3
- Display[1048575] = 1 #Apply changes
- Display[1048572] = Resolution #Set new resolution on Y (Height)
- Display[1048573] = Resolution #Set new resolution on X (Width)
- #Stiff
- E = entity()
- Pos = E:pos()
- Scale = 1
- Alpha = 255
- #X Axis
- holoCreate(0, Pos, vec(Scale, Scale, Scale))
- holoModel(0, "cube")
- holoColor(0, vec(255, 0, 0), Alpha)
- #Y Axis
- holoCreate(1, Pos, vec(Scale, Scale, Scale))
- holoModel(1, "cube")
- holoColor(1, vec(0, 255, 0), Alpha)
- #Z Axis
- holoCreate(2, Pos, vec(Scale, Scale, Scale))
- holoModel(2, "cube")
- holoColor(2, vec(0, 0, 255), Alpha)
- #Pause then begin
- timer("Run", 1000)
- }
- function number lerp(A:number, B:number, C:number)
- {
- return A + C * (B - A)
- }
- function void scan()
- {
- B = E:up()
- A = E:pos() + B + E:right() * (P % Resolution - Resolution / 2) * S + E:forward() * (floor(P / Resolution) - Resolution / 2) * S
- holoPos(0, A)
- Trace = rangerOffset(16000, A, B)
- J = H > 0 ? Trace:distance() : lerp(J, Trace:distance(), 1/H)
- H++
- D = max(127 - (Trace:distance() - J) / 5, 0)
- C = Trace:entity()
- F = 2 - C:isValid()
- G = 2 - C:isPlayer()
- holoPos(1, Trace:pos())
- Display[P] = rgb2digi(vec(D / F, D, D / G), 3)
- #Wrap the points
- if(P == R)
- {
- P = 0
- }
- else
- {
- P++
- }
- }
- #Begin code
- if(clk("Run"))
- {
- #Trace
- #H = rangerOffset(16000, E:pos(), E:up())
- H = 0
- J = 0#H:distance()
- #holoPos(2, H:pos())
- scan()
- scan()
- scan()
- scan()
- scan()
- scan()
- scan()
- scan()
- scan()
- scan()
- scan()
- scan()
- scan()
- scan()
- scan()
- scan()
- scan()
- scan()
- scan()
- scan()
- #
- #Loop
- timer("Run", 10)
- }
Advertisement
Add Comment
Please, Sign In to add comment