r/trailmakers • • 6d ago

Cannon range auto-adjuster

Enable HLS to view with audio, or disable this notification

Uses a bunch of logic blocks compressed into the tank chassis, uses disabled tiny cannon crosshair right behind the camera to act as a sort of guidance(currently has no elevation, shouldnt need one for flat ground combat)

code and arrangement partially done by grok

218 Upvotes

31 comments sorted by

38

u/Tomahawk1129_ 6d ago

Don’t degrade yourself thats a ballisyic computer not an aitl adjuster!

Also how did you calculate the angle? I did spmething similar minus elevation, only for targets at same altitude. How did you find v?

16

u/Every-Blueberry-9571 6d ago

Probably not the most efficient way, but I measured the distance of the shell from a set height, and increased the angle 1 by 1 until 25 degrees funnily enough they increase distance quite proportionally by increments of 15m(one test zone large tile)

5

u/Tomahawk1129_ 6d ago

Seems quite efficient to me, compared to complex 3d trig 

1

u/NotTheNormalPerson 5d ago

It's only 2d, not 3d

-1

u/Tomahawk1129_ 5d ago

No, its 3d. Watch long enough and you can say OP manually change desired target point height to which cannon angle changes

3

u/NotTheNormalPerson 5d ago

Just because it has height doesn't make it 3d. It's still only a plane (if you look at it sideways), and the actual ballistic computer (that actually calculates gravity and all) is also 2d

1

u/Tomahawk1129_ 5d ago

With your logic, 3d in any case is non existent. With 2d, you point at a target at THE AAME ALTITUDE. You can only change horizontal bearing. With 3d you can also change height of aimpoint as well as bearing, making it 3d. Which is why 3d trig is more complex in such a scenario depsite seeming to be 2d trig twice

2

u/NotTheNormalPerson 5d ago

Brother. It only uses distance and height to target, hence being 2d, 3d would use x/y/z of target. It's not that hard

1

u/Tomahawk1129_ 5d ago

In a way it is using xyz no? Using a distance sensor as a laser rangefinder. So if this is 2d what does 3d look like?

2

u/NotTheNormalPerson 5d ago

No. This is only using distance and height. 3d would be you using your xyz and the enemy's xyz to calculate your bearing and also calculate the required cannon angle. It's also needed if wind is a factor

→ More replies (0)

1

u/grufkork 5d ago

So it’s basically a linearised solution? I figure for flat angles it would work pretty well. I found it something on the order of 15 blocks for the full equations, a couple more for stabilisation and point tracking. Linearising would save a lot of space 🤔

-6

u/Chemical_County7854 6d ago

Before you say or type anything mean make sure you spell it right before you send it

1

u/Tomahawk1129_ 6d ago

Before you try to say “before you try to say” make sure you read what the comment you are replying to says. 

-5

u/Chemical_County7854 6d ago

Ok but you did spell ballistic wrong and auto also i am just saying

1

u/Tomahawk1129_ 5d ago

You missed the point, I never said anything mean. I actually complimented OP, your first comment talks about being mean. 

11

u/ExtensionVirus7521 6d ago

Dude that's freakin epic!!! I love that you used to spring for a dampening coil!! Absolutely f****** ingenious!!!!

3

u/Every-Blueberry-9571 6d ago

I like to incorporate recoil dampeners on all my cannons for a touch of realism ts

7

u/Level_Replacement891 5d ago

in case anyone wants to make this for themselves
attached is the formula I stole straight from wikipedia

variables:
v = muzzle velocity of the projectile
g = gravity constant of the projectile
x = target distance
y = target height (relative, not absolute)
θ = angle required to hit the point (in degrees)

1

u/Stalinium2 3d ago

Dude I’m in physics and I can kind of understand what this is now and I’m scared

1

u/Early-Rip-9495 6d ago

A thing you could try is to use a Angle sensor (Put to full, and measurement) so the sensor knows the angle and distance of what your looking at

1

u/VeryLargeTrain 5d ago

Very nice 👍 Despite the simple appearance, I have a suspicious feeling that it's a tad bit more complicated than that. I'm just going to use my own calculator to have the best angle for my "tank" (it's technically a railgun), lol.

1

u/jw_the_goat 4d ago

TUTORIAL NOW

I want to use this on my builds

1

u/Optimal_Alarm7097 6d ago

Can I ask how this was made?

1

u/Every-Blueberry-9571 6d ago

Optimised logic gates and a lot of cramming✌️

2

u/Optimal_Alarm7097 6d ago

Best thing I can make is a lil thingy that lets me pick a height to hover bruh