E2 help - Hover Bot-

Hello facepunch !

Im new to E2 having only got wire to correctly work yeasterday and ive had some sucsess in making a security alarm and chat controlled lift but now ive got a problem.

Im trying to make a chip that when attached to a prop will stabilise it ( keep it upright) and has forward back left right up and down inputs so that the chip will move the prop with apply force.

Here is the code so far ( T is turn, S is for strafe)

@name Hover
@inputs Forward Backward T_left T_Right S_Left S_Right Up Down
@outputs Gyro:angle


Plate = entity():isWeldedTo()
Gyro = -Plate:angles()*1000

FW = vec(5000,0,0)
BK = vec(-5000,0,0)
SL = vec(0,5000,0)
SR = vec(0,-5000,0)
UP = vec(0,0,5000)
DN = vec(0,0,-5000)

Plate:applyForce(vec(0,0,Plate:mass()+200) gravity() / 66.56669)
Plate:applyAngForce((Gyro + $Gyro
5) * (Plate:mass()))

if(Forward == 1) {Plate:applyForce(FW)}

…(continued for BK SL SR UP and DN)…

This makes the plate hover at any height stabily and when wired to inputs move about howether it allways faces in one direction and i can’t figure out how to make only pitch and roll stabilise so it will be able to turn !

Any help would be greatly appreciated, thanks in advance :slight_smile:

Plate:applyAngForce((Gyro + $Gyro*5):setYaw(0) * (Plate:mass()))

And please remember to use [noparse]

[/noparse] tags for code in future.

Thanks much, thats just what i needed :stuck_out_tongue:


Well I’ve got some bad news. The test results just got back from the lab, and I regret to inform you that you’ve been diagnosed with a severe case of retardation.

That is all.