-
Notifications
You must be signed in to change notification settings - Fork 10
/
scp-018.txt
38 lines (34 loc) · 1002 Bytes
/
scp-018.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@name scp-018
@inputs
@outputs
@persist Ball:entity TRAIL_QUALITY
@trigger
@strict
if( first() ){
propSpawnUndo(0)
TRAIL_QUALITY = 16
Ball = propSpawn("models/holograms/hq_icosphere.mdl",entity():pos()+vec(0,0,40),0)
Ball:makeSpherical()
Ball:setMaterial("pac/default")
Ball:setColor(vec(255,0,0))
Ball:propDrag(0)
Ball:setMass(200)
Ball:propPhysicalMaterial("canister")
for(I=1,TRAIL_QUALITY){
holoCreate(I)
holoModel(I,"hq_icosphere")
holoColor(I,vec(255,0,0),75*I/TRAIL_QUALITY)
holoMaterial(I,"pac/default")
}
trackCollision(Ball, function(_:entity, _:entity, C:collision){
local OldVel = C:ourOldVel()
local HitNorm = C:hitNormal()
local NewVel = OldVel - 2 * HitNorm:dot(OldVel) * HitNorm
Ball:setVelocity( NewVel * 1.8 )
})
}
event tick(){
for(I=1,TRAIL_QUALITY){
holoPos(I, mix(Ball:pos(), Ball:pos()+Ball:vel()*tickInterval(), 1-I/TRAIL_QUALITY))
}
}