-
Notifications
You must be signed in to change notification settings - Fork 11
Expression2 (Examples)
shadowscion edited this page May 21, 2021
·
3 revisions
@name e2m_example_basic
@inputs
@outputs
@persist
@trigger
# assign number of controllers you want on the entity
P = p2mCreate(2, entity():pos(), entity():angles())
# push to the desired controller index
P:p2mSetColor(1, vec(255, 0, 0))
P:p2mPushModel(1, "models/props_borealis/bluebarrel001.mdl", vec(), ang())
P:p2mPushModel(1, "models/props_borealis/bluebarrel001.mdl", vec(55,0,0), ang())
#
P:p2mSetColor(2, vec(0, 255, 0))
P:p2mPushModel(2, "models/props_borealis/mooring_cleat01.mdl", vec(0,0,50), ang(45,0,0))
# build
P:p2mBuild()@name p2m_linkent_example
@inputs
@outputs
@persist
@trigger none
if (first()) {
holoCreate(1)
holoCreate(2, holoEntity(1):toWorld(vec(0, 0, 30)))
holoParent(2, 1)
holoCreate(3, holoEntity(1):toWorld(vec(0, 10, 25)))
holoParent(3, 1)
holoCreate(4, holoEntity(1):toWorld(vec(0, -10, 25)))
holoParent(4, 1)
holoCreate(5, holoEntity(1):toWorld(vec(0, 8, -1)))
holoParent(5, 1)
holoCreate(6, holoEntity(1):toWorld(vec(0, -8, -1)))
holoParent(6, 1)
for (I = 1, 6) {
holoScale(I, vec(0.25))
holoColor(I, vec(255, 0, 0))
}
E = p2mCreate(6, holoEntity(1):pos(), holoEntity(1):angles())
E:p2mSetParent(holoEntity(1))
E:p2mSetLink(1, holoEntity(1), holoEntity(1):toLocal(E:pos()), holoEntity(1):toLocal(E:angles()))
E:p2mSetUV(1, 128)
E:p2mPushModel(1, "models/props_c17/oildrum001.mdl", vec(0, 0, 0), ang(), vec(0.6, 0.6, 30/45))
E:p2mSetLink(2, holoEntity(2), holoEntity(2):toLocal(E:pos()), holoEntity(2):toLocal(E:angles()))
E:p2mSetUV(2, 128)
E:p2mPushModel(2, "models/props_c17/oildrum001.mdl", vec(0, 0, 30.5), ang(), vec(0.3, 0.3, 8/45))
E:p2mSetLink(3, holoEntity(3), holoEntity(3):toLocal(E:pos()), holoEntity(3):toLocal(E:angles()))
E:p2mSetUV(3, 128)
E:p2mPushModel(3, "models/props_c17/oildrum001.mdl", vec(0, 10, 25), ang(180, 0, 0), vec(0.3, 0.3, 24/45))
E:p2mSetLink(4, holoEntity(4), holoEntity(4):toLocal(E:pos()), holoEntity(4):toLocal(E:angles()))
E:p2mSetUV(4, 128)
E:p2mPushModel(4, "models/props_c17/oildrum001.mdl", vec(0, -10, 25), ang(180, 0, 0), vec(0.3, 0.3, 24/45))
E:p2mSetLink(5, holoEntity(5), holoEntity(5):toLocal(E:pos()), holoEntity(5):toLocal(E:angles()))
E:p2mSetUV(5, 128)
E:p2mPushModel(5, "models/props_c17/oildrum001.mdl", vec(0, 8, -1), ang(180, 0, 0), vec(0.35, 0.35, 30/45))
E:p2mSetLink(6, holoEntity(6), holoEntity(6):toLocal(E:pos()), holoEntity(6):toLocal(E:angles()))
E:p2mSetUV(6, 128)
E:p2mPushModel(6, "models/props_c17/oildrum001.mdl", vec(0, -8, -1), ang(180, 0, 0), vec(0.35, 0.35, 30/45))
E:p2mBuild()
interval(150)
}
if (clk()) {
interval(60)
local S = sin(curtime()*360)
local C = cos(curtime()*360)
holoPos(1, entity():toWorld(vec(0, 0, abs(S)*5)))
holoAng(3, holoEntity(1):toWorld(ang(-S*15, 0, 0)))
holoAng(4, holoEntity(1):toWorld(ang(S*15, 0, 0)))
holoAng(5, holoEntity(1):toWorld(ang(S*35, 0, 0)))
holoAng(6, holoEntity(1):toWorld(ang(-S*35, 0, 0)))
}