@name trig_test
@inputs 
@outputs 
@persist Radius Rate Rotate DT CT Pos:vector
@trigger 

if (first()) {
    
    Radius = 30
    
    holoCreate(1)
    holoPos(1, rangerOffset(100, entity():pos(), vec(0,0,-1)):pos() + vec(0, 0, Radius))
    holoAlpha(1, 50)
    
    
    local N = 1
    for (I = 0, 3) {
        N++
        holoCreate(N)
        holoScaleUnits(N, vec(4))
        holoPos(N, holoEntity(1):toWorld(vec(sin((360/10)*N)*Radius, 0, cos((360/10)*N)*Radius)))
    }

    N++
    holoCreate(N)
    
    function dt(Interval) {
        interval(Interval)
        DT = curtime() - CT
        CT = curtime()
    }
    CT = curtime()
    
    dt(60)
DesiredMPH = 5
Circumference = 2 * pi() * Radius
InchesPerInterval = DesiredMPH*(0.0176/DT)

RevPerInterval = InchesPerInterval * Circumference


}

dt(60)


#[60 mph (5280 ft/mi) (1 hr / 3600 s) (12 in/ ft) = 1056 in/s ..... convert mph to ips
1056 in/s (1 revolution/(30 in)) = 11.2 rps ................  is approx. 3.14159

If you need to convert rev/sec to radians/sec:
11.2 rps (2 radians / rev) = 70.4 radians/s

Incidentally, that's 2112/30 = 70.4 ]#


DesiredMPH = 35
Circumference = 2 * pi() * Radius
InchesPerInterval = DesiredMPH*(0.0176/0.06)#DT)

RevPerInterval = InchesPerInterval * Circumference


if (RevPerInterval){

DegreesPerSec = RevPerInterval
Rate = DegreesPerSec*DT #sin(curtime()*15)*45
Rotate += Rate

local Rad = toRad(Rate)
local Mov = Rad*Radius
local Dir = vec(Mov, 0, 0)

#print( toUnit("mph", Dir:length()) )


holoAng(1, Dir:toAngle())
holoPos(1, holoEntity(1):pos() + Dir)


print(toUnit("mph", Dir:length() * (1/DT)))


local N = 0
holoPos(2, holoEntity(1):toWorld(vec(30 + sin(Rotate+N)*Radius, 20, max(0, cos(Rotate+N)*Radius/2))))


local N = 45
holoPos(3, holoEntity(1):toWorld(vec(30 + sin(Rotate+N)*Radius, -20, max(0, cos(Rotate+N)*Radius/2))))


local N = 180
holoPos(4, holoEntity(1):toWorld(vec(-30 + sin(Rotate+N)*Radius, 20, max(0, cos(Rotate+N)*Radius/2))))


local N = 225
holoPos(5, holoEntity(1):toWorld(vec(-30 + sin(Rotate+N)*Radius, -20, max(0, cos(Rotate+N)*Radius/2))))


holoPos(6, holoEntity(1):toWorld(vec(0, 0, 30 + abs(cos(Rotate/2)*Radius/2))))
holoAng(6, holoEntity(1):toWorld(ang( sin(-Rotate)*Radius/2, 0, 0)))
}
   # holoPos(10, Base:toWorld(vec(0, 0, -35 + abs(cos(FrameTime/2)*FootControllers["fl", table]["stepH", number]))))
   # holoAng(10, Base:toWorld(ang(5+sin(-FrameTime)*FootControllers["fl", table]["stepH", number], 0, -Base:toLocalAxis(MoveDir*Speed):y())))
    
#[
Rate = sin(curtime()*100)*50
Rotate += Rate

local Rad = toRad(Rate)
local Mov = Rad*Radius

holoPos(1, holoEntity(1):pos() + vec(Mov, 0, 0))

local N = 1
for (I = 0, 10) {
    N++
    holoPos(N, holoEntity(1):toWorld(vec(sin(Rotate+(360/10)*N)*Radius, 0, clamp(cos(Rotate+(360/10)*N)*Radius, -Radius/2, Radius/2))))
}]#
