E2 help

I’m using this E2 for my turret on my vechile
@outputs Gyro:angle
@persist

runOnTick(1)

Plate = entity()

Me = owner()

P = Plate:elevation(Me:aimPos())
Y = Plate:bearing(Me:aimPos())
R = Plate:angles():roll()

Gyro= -ang(P,Y,R)*1000

Plate:applyAngForce(Gyro + $Gyro*5)

But I need a e2 that looks where a player sitting in a vechile(adv vpod used) looking where the player is looking but only when he/she is in it. Any ideas?

Hmm…



@name Turret
@inputs Veh:entity #wire to adv pod entity
@persist E:entity Torque:vector
if (first()) {
E = entity()
E:setMass(1000)
runOnTick(1)
}

E:applyForce(( (Veh:pos() + vec(0,0,80) - E:pos())*20 - E:vel())*E:mass())
Torque = E:toLocal(rotationVector(quat(Veh:driver():eyeAngles())/quat(E))+E:pos())
E:applyTorque((Torque*100-E:angVelVector()*10)*E:inertia())


You don’t need to show him torque right away. That’s better for when you are good at E2.

He asked for code, not to learn.
/case