@name SimsPlayer
@inputs [Pod Cam]:wirelink 
@outputs 
@persist 
@trigger 
runOnTick(1)

local Seat = Pod["Entity",entity]
local Driver = Seat:driver()
local Active = Driver:isPlayer()
local W = Driver:keyForward()
local A = Driver:keyLeft()
local S = Driver:keyBack()
local D = Driver:keyRight()
Cam["Activated", number] = Active

Size = 1

if (first() | dupefinished()) {
    holoCreate(1)
    holoPos(1,entity():toWorld(vec(0,0,0.1)/Size))
    holoAng(1,entity():toWorld(ang(0,90,0)))
    holoScale(1,vec(0.03,0.03,0.025)/Size)
    
    holoCreate(2)
    holoModel(2,"hq_rcylinder_thick")
    holoMaterial(2,"models/wireframe")
    holoModel(1,owner():model())
    holoPos(2,entity():toWorld(vec(0,0,1)/Size))
    holoScale(2,vec(0.1,0.1,0.15)/Size)
    holoAlpha(2,0)
    holoParent(2,1)
    
    holoCreate(3)
    holoPos(3,holoEntity(1):toWorld(vec(0,0,1.7)/Size))
    holoAng(3,holoEntity(1):toWorld(ang(0,0,0)))
    holoScale(3,vec(0.03,0.03,0.025)/Size)
    holoAlpha(3,0)
    holoParent(3,1)
    
    Cam["Parent", entity] = holoEntity(3)
    Cam["Position", vector] = holoEntity(3):pos()
}

if (W) {holoPos(1,holoEntity(1):pos() + holoEntity(1):forward()/10)}
if (S) {holoPos(1,holoEntity(1):pos() - holoEntity(1):forward()/10)}
if (A) {holoPos(1,holoEntity(1):pos() - holoEntity(1):right()/10)}
if (D) { holoPos(1,holoEntity(1):pos() + holoEntity(1):right()/10)}

if (changed(W) & W) {holoAnim(1,11)}

if ((changed(W)|changed(S))&!W & !S) {holoAnim(1,14)}

Ranger = rangerOffset(999999,holoEntity(1):pos(),Driver:eye())

Yaw = (Ranger:position() - holoEntity(1):pos()):toAngle():yaw()

holoAng(1,ang(0,Yaw,0))
