The guns;
@name Trajectory Coordinate Gun
@inputs Active Position:vector
@outputs
@persist Bearing Elevation Distance Area:vector
runOnTick(1)
Area = Position
Compensate = (atan(0.0036/8100 * Distance*cos(entity():angles()

itch())))
Bearing = entity():bearing(Area)
Elevation = entity():elevation(Area)
Distance = (Position-entity()

os()):length()
Speed = 100
Torque = 35
Rigidity = 30
Aim = ang(-entity():angVel()

itch()+clamp((-Elevation-Compensate)*Rigidity*Active,-Speed,Speed),-entity():angVel():yaw()+clamp(-Bearing*Rigidity*Active,-Speed,Speed),-entity():angVel():roll()-entity():angles():roll()*30) * shiftL(ang(entity():inertia())) * Torque
entity():applyAngForce(Aim)
The camera sensor;
@name WASD Position Holding Sensor
@inputs Active W A S D EyeX EyeY CamTog Shift Vehicle:entity
@outputs Distance Camera Zoom Chip:entity Forward:vector Position:vector TrackEnt:entity TrackPos:vector TX TY TZ
@persist Zoom Distance Trace:ranger
runOnTick(1)
HoldingTorque = 35
#Camera Toggle
if (~CamTog & CamTog) {Camera = !Camera}
if (Active==0) {Camera = 0}
#Camera Zoom
if (~Shift & Shift) {Zoom -= (Zoom/1.2)}
if (Zoom<1) {Zoom = 70}
if (Active==0) {Zoom = 70}
#Distance Ranger
rangerDefaultZero(1)
Trace = rangerOffset(150000,entity()

os()+entity():forward()*500,entity():forward())
Distance = Trace:distance()+500
Forward = entity():forward()
Position = entity()

os()+entity():forward()*500
TrackPos = Trace

osition()
TX = Trace

osition():x()
TY = Trace

osition():y()
TZ = Trace

osition():z()
TrackEnt = Trace:entity()
#WASD Manual Aiming
Radian = 57.28
MotionPitch = entity():vel():dot(entity():up())*Radian/Distance*Active
MotionYaw = entity():vel():dot(entity():right())*Radian/Distance*Active
Anglo = ang((-EyeY+(S-W))*Zoom/3*Active+MotionPitch-entity():angVel()

itch(),((-EyeX+(A-D))/2)*Zoom*Active*abs(cos(entity():angles()

itch()))+MotionYaw-entity():angVel():yaw(),-entity():angles():roll()*30-entity():angVel():roll()) * shiftL(ang(entity():inertia())) * HoldingTorque
entity():applyAngForce(Anglo)
if (~Active & Active) {Vehicle:hintDriver("Press SPACE for camera mode Press Shift to zoom Use WASD and the mouse to aim.",7)}
These are the updated E2's that work just like the ones on my SUAV. These use coordinates instead of angles so they work for guns that are farther apart like the ones on the AC130.
Bookmarks