Drones can vary in complexity, I doubt you'll get a step-by-step on it. Learn how to stabalise things, learn how to make things aim, learn how to make things chase other things. A drone is an application of these things (and more).
You is Wrong.
Okay I have drawded you an example of how one would look and included the expression 2 coding.
Installation
Go to your Expression folder, found in C:/ProgramFiles/Steam/Steamapps/YOURNAME/Garrysmod/Garrysmod/Data/Expression2
And create a new text document (NOT RICH TEXT DOCUMENT) and name it appropriately. Copy and Paste the code into that Text File and click save!
Now you have the expression!
Introduction
The first thing do deciding how to build a drone is how you are going to build it. Here you have a number of options.
-Hover Ball
-All Thruster Powered (Delta)
-Vector Thruster
For my example, I'm using Vector Thruster. Here's the code.
Code:
@name Vector Turret Proccessor
@inputs Tf:entity On
@outputs Vector:vector Dis Mul
interval(100)
Pos = entity():pos()
Vector = Pos - Tf:pos()
Dis = Vector:length()
if(On) {Mul=1000000000}
Setup
Tf:entity goes to Target Finder [ENTITY] Output.
On goes to Numpad Input Toggle
Vector:vector goes to a Vector Thruster [VECTOR] Input
Mul goes the a Vector Thruster Mul Input
Wire the standard thruster to whatever you want to control it going Forward / Backward. For example
Wire a Greater Than Chip A to the Dis Output on the Expression 2 Chip, and Greater Than Chip B to a Constant Value of 50.
So that way, if the distance from the drone to the target is Greater than that of 50, then it will turn the thruster on and propel the drone towards the target. But if the target is Less Than 50 units from the drone, then the thrust is nullified.
Make sure that the Vector Thruster settings are XYZ World and it is Bi Directional
Hit up the entire plate with Physical Property, Gravity Toggle box unchecked.
Here is a Picasso style painting I made to guide you. (Its Attached)
Another form is uses Hoverballs, this can be done by putting four Hoverballs in their respective corners. You would have a Beacon Sensor on the front outputting Bearing, and XYZ World.
Here's an untested code that I've whipped together for you.
Code:
N@Tracker CPU
I@Bearing Distance Target WorldZ PlateZ
O@Thrust FThrust ZVel
Thrust = $Bearing*5+Bearing*On
If Distance > 100 -> FThrust = 1*On;
If Distance < 100 -> FThrust = -1*On;
If Target == 1 -> On = 1;
If Target == 0 -> On = 0;
WorldZ>PlateZ->ZVel=1;
WorldZ<PlateZ->ZVel=-1;
WorldZ==PlateZ->ZVel=0;
Should be self explanatory
This should help you out a bunch.
If you still fail to understand this, here's a picture of a cucumber!
Bookmarks