Author Topic: Whats a good aiming system to calculate the kill zone of artillery?  (Read 152 times)

0 Members and 1 Guest are viewing this topic.

Offline StartedBullet

  • ****
  • Posts: 262
  • Gender: Male
  • Blissfully unaware, or am I?
  • Respect: +19
Hey, I'm interested in making artillery but cannot seem to find a good aiming system. I started on one in an e2 chip but it's so horribly flawed I'll never fix it. Any ideas? 

My E2:
Code: [Select]
@name ArtilleryControlChipmk1
#Barrel Angle
@inputs  SaveBarrelA  Barrel1 Barrel2 Barrel3 RecallBarrelA1
@inputs  RecallBarrelA2  RecallBarrelA3 CurrentBarrelA Reset
#Other Inputs
@inputs
@inputs RaiseB LowerB  Start Missile:entity SavedMissile:entity
#Barrel Angle
@outputs BarrelAngle Reload Force Effect SoundOn SoundOff SoundPower
#Other Outputs
@outputs Fire
@persist FlatDistance BarrelA1 StoredBarrelA1 IP MissilePos2:vector MissilePos3:vector MissilePosXYZ
@persist MissileArc:vector MissilePos:vector MissilePos4:vector MissileFinalDist MissilePosXYZ2 IF
@trigger
interval(100)
# For Saving/Recalling Succesful Angles

if (SaveBarrelA){

    Barrel1=CurrentBarrelA

}

if (SaveBarrelA & Barrel1){

 Barrel2=CurrentBarrelA

}

if (SaveBarrelA & Barrel2){

    Barrel3=CurrentBarrelA 

}

# For Adjusting The Barrel Angle

if (RaiseB){
    BarrelAngle=CurrentBarrelA+1/50
}

if (LowerB){
    BarrelAngle=CurrentBarrelA-1/50
}

# For Recalling Barrel Angles

if (RecallBarrelA1 & Barrel1){
    BarrelAngle=Barrel1
}

if (RecallBarrelA2 & Barrel2){

    BarrelAngle=Barrel2
}


if (RecallBarrelA3 & Barrel3){

    BarrelAngle=Barrel3
}


# For Reseting Stored Barrel Angles
if (Reset){
    Barrel1=0
    Barrel2=0
    Barrel3=0
   
}


# For firing/Loading

if (Start & !IP){
    IP=1
    Reload=1
    timer("Fire", 1000)
}

if (IP & clk("Fire")){
    Reload=0
    SoundOn=1
    SoundPower=7
    Force=35^5
    timer("Reset", 1000)
}

if (IP & clk("Reset")){
    SoundOn=0
    SoundOff=1
    SoundPower=7
    Force=0
    IP=0
}

if (Missile & !IF){
    SavedMissile=Missile
    MissilePos=SavedMissile:pos():y()
    MissilePosXYZ=SavedMissile:pos():distance(Missile:pos())
    IF=1
   
    timer("Pos2", 100)
}

if (clk("Pos2")){
    MissilePos2=SavedMissile:pos(y):y()
    timer("pos3", 100)
}

if (clk("Pos3")){

    MissilePos3=SavedMissile:pos(y):y()
    timer("pos4", 100)

}


if (clk("Pos4")){

    MissilePos4=SavedMissile:pos(y):y()
    MissilePosXYZ2=SavedMissile:pos():distance(Missile:pos())
   
    MissileArc=((MissilePos3+MissilePos2/2) - (MissilePos4 - MissilePos) )
    FlatDistance=((MissilePosXYZ2-MissilePosXYZ) - MissileArc)
    IF=0
    SavedMissile=Missile
    MissilePos=Missile:pos(y)
    MissilePos2=Missile:pos(y)
    MissilePos3=Missile:pos(y)
    MissilePos4=Missile:pos(y)
    MissilePosXYZ=0
    MissilePosXYZ2=0
   
}

Turned a new leaf.


Furry artist.

Offline Peetah

  • ******
  • League PlayerWindows UserDog Lover
    View More Badges!

  • Posts: 3000
  • Gender: Male
  • Respect: +823
Re: Whats a good aiming system to calculate the kill zone of artillery?
« Reply #1 on: June 27, 2011, 11:57:26 AM »
0
It seems as though you are over complicating things.
An artillery, you would only need to hit one position.
Really, dont need to make it too advance...

If ya really want to get something good.
I would suggest your go in and research how to clamp() and use it in your e2.
(Reg) Nezz45: peetah are you good with the weight tool?

Offline StartedBullet

  • ****
  • Posts: 262
  • Gender: Male
  • Blissfully unaware, or am I?
  • Respect: +19
Re: Whats a good aiming system to calculate the kill zone of artillery?
« Reply #2 on: June 27, 2011, 12:08:19 PM »
0
Well that ought to help determine at which point the trajectory( if it were straight, which it is ) would be placed at. I think I'll look up how to use holo emitters and project a line to that point.
Is there away to convert a vector into X Y Z and back again? If I can figure out the mph of the projectile ( I'm not sure how I'll do this ) I can calculate the drop of the projectile ( providing gmod physics hold true ) and modify the vector to accomadate the drop of the projectile.

Thanks by the way.

EDIT: This does not seem to work. I tried using a new bare chip connected to a holoemmiter and a barrel horizontal and above the ground.

E2:
Code: [Select]
@name Trowihtzer
@inputs Start Missile:entity AdditionalAimingLength
@outputs Force Reload AimingVector:vector
@persist MissileVector:vector
@trigger
interval(100)

if (Missile){
    MissileVector=Missile:pos()
    AimingVector=clamp(MissileVector, 59, 60)
}



I see no reason for it not to.
« Last Edit: June 27, 2011, 12:38:53 PM by StartedBullet »
Turned a new leaf.


Furry artist.

Offline Peetah

  • ******
  • League PlayerWindows UserDog Lover
    View More Badges!

  • Posts: 3000
  • Gender: Male
  • Respect: +823
Re: Whats a good aiming system to calculate the kill zone of artillery?
« Reply #3 on: June 27, 2011, 01:15:19 PM »
0
Hmmm.
Well lets get this strait.
A vector Is XYZ. To get a specific axis. do Vector:z() Vector:x(), y() etc...

Now if you are finding the drop hmmm.
The drop of the bullet would not change the X or Y only the Z.
So find a formula that works with the drop of the bullet. Z = Vector:z()+(Whatever the formula here)

Just to spark some ideas.
(Reg) Nezz45: peetah are you good with the weight tool?

Offline Seb

  • ******
  • Posts: 2880
  • Gender: Male
  • Respect: +783
Re: Whats a good aiming system to calculate the kill zone of artillery?
« Reply #4 on: June 27, 2011, 01:19:14 PM »
0
I thought it was IRL, I have no idea bro.
Miami's Finest

Offline StartedBullet

  • ****
  • Posts: 262
  • Gender: Male
  • Blissfully unaware, or am I?
  • Respect: +19
Re: Whats a good aiming system to calculate the kill zone of artillery?
« Reply #5 on: June 27, 2011, 05:07:09 PM »
0
I can't seem to get ANY holoemitter working, is it broken?
Turned a new leaf.


Furry artist.

Offline Pontus

  • **
  • Posts: 90
  • Respect: +40
Re: Whats a good aiming system to calculate the kill zone of artillery?
« Reply #6 on: June 27, 2011, 06:59:24 PM »
0
this is real cpomplex but i like the work u have done ^^

 :thumbsup:

Offline StartedBullet

  • ****
  • Posts: 262
  • Gender: Male
  • Blissfully unaware, or am I?
  • Respect: +19
Re: Whats a good aiming system to calculate the kill zone of artillery?
« Reply #7 on: June 27, 2011, 07:47:46 PM »
0
I think I'll lay off artillery for a while, feel free to fix it.
Turned a new leaf.


Furry artist.