Closed Thread
Page 2 of 7 FirstFirst 1234 ... LastLast
Results 11 to 20 of 63

Thread: Mike Dude's HK-Drone Version 2 RELEASE

  1. #11
    Wire Sofaking emspike's Avatar
    Join Date
    Feb 2008
    Posts
    911

    Default Re: Mike Dude's HK-Drone Version 2 RELEASE

    Heres the flight expression optimized (out of game, if I accidentally f'd something up tell me). I think I got everything.

    PHP Code:
    @name HK-Drone V2
    @inputs [RPod LPod APod]:entity Pod:wirelink
    @outputs RThrust LThrust AThrust Altitude Angles:angle HoverThrust RPitch LPitch APitch Ground
    @persist RPitch LPitch TZ Altitude Roll Pitch ForwardVel SideVel RPodChange LPodChange
    @persist AngVel SpeedCounter SpinCounter Bank Acc Right Left APitch UpsideDown Torque
    @persist [Self Base]:entity

    interval
    (50)

    if(
    first()){
        
    Self entity()
        
    Altitude=Self:pos():z()
        
    Base Self:isWeldedTo()
        
    rangerHitWater(1)
        
    rangerFilter(Base)
        
    rangerPersist(1)
    }


    Active=Pod["Active"]
    W=Pod["W",number]
    A=Pod["A",number]
    S=Pod["S",number]
    D=Pod["D",number]
    Mouse1=Pod["Mouse1",number]
    Mouse2=Pod["Mouse2",number]
    R=Pod["R",number]
    Space=Pod["Space",number]
    Shift=Pod["Shift",number]
    Alt=Pod["Alt",number]
    Driver=Pod["Entity",number]:driver()
    AimPos=Pod["AimPos",number]
    Bearing=Pod["Bearing",number]
    Elevation=Pod["Elevation",number]

    ###Minimum Height

    Ground rangerOffset(64000,Self:pos(),vec(0,0,-1)):position():z()+40

    ###Flying Altitude

    if(!Active){
        
    Altitude=Self:pos():z()
        
    RPitch=UpsideDown*RPod:angles():pitch()
        
    LPitch=UpsideDown*LPod:angles():pitch()
        
    APitch=UpsideDown*APod:angles():pitch()
        
    RPod:applyAngForce(ang(RPitch+$RPitch*4,0,0)*20)
        
    LPod:applyAngForce(ang(LPitch+$LPitch*4,0,0)*20)
        
    APod:applyAngForce(ang(APitch+$APitch*4,0,0)*20)
        
    RThrust=0
        LThrust
    =0
        AThrust
    =0
    }
    else{
        if(
    Shift){
            
    Altitude=clamp(Altitude+3,Ground,999999999)
        }elseif(
    Space){
            
    Altitude=clamp(Altitude-3,Ground,999999999)
        }
        
    ###Maintain Altitude
        
        
    Self:pos():z()
        
    TZ = (-Altitude)
        
    HoverThrust=(TZ+$TZ*10)
        
        
    ###Angle of Thruster Pods
        
        
    if(abs(Pitch)>90){
            
    UpsideDown=-1
        
    }else{
            
    UpsideDown=1
        
    }
        
    GoAngle=40*(S-W)
        
    TurnAngle=20*(D-A)
        
        
    RPitch=clamp((RPod:angles():pitch()+GoAngle+TurnAngle+SpeedCounter+SpinCounter),-90,90)
        
    LPitch=clamp((LPod:angles():pitch()+GoAngle-TurnAngle+SpeedCounter-SpinCounter),-90,90)
        
    APitch=clamp((APod:angles():pitch()+GoAngle+SpeedCounter),-90,90)
        
    RPod:applyAngForce(ang(RPitch*1+$RPitch*4,0,0)*180)
        
    LPod:applyAngForce(ang(LPitch*1+$LPitch*4,0,0)*180)
        
    APod:applyAngForce(ang(APitch*1+$APitch*2,0,0)*180)
        
        
    ###Hover Balance
        
        
    SelfAngs Self:angles()
        
    Angles=SelfAngs
        Roll
    =SelfAngs:pitch()
        
    Pitch=SelfAngs:roll()
        
    RollCounter=(Roll+$Roll*3)*3
        PitchCounter
    =(Pitch+$Pitch*2)*4
        StrafeCounter
    =(SideVel+$SideVel*0.25)/2+1.25
        
        CosP 
    HoverThrust/cos(Pitch)
        
        
    RThrust=clamp(UpsideDown*(CosP-RollCounter-StrafeCounter),0,200)
        
    LThrust=clamp(UpsideDown*(CosP+RollCounter+StrafeCounter),0,200)
        
    AThrust=clamp(UpsideDown*(CosP-PitchCounter),-100,100)
        
        
    ###Counter Movement
        
        
    if(W|S){
            
    SpeedCounter=0
        
    }else{
            
    SpeedCounter=-(Self:velL():y())/12+0.25
        
    }
        if(
    A|D){
            
    SpinCounter=0
        
    }else{
            
    SpinCounter=(Self:angVel():yaw())/4
        
    }


  2. #12
    Wire Noob Ryuuzaki11's Avatar
    Join Date
    Jun 2009
    Location
    France, South
    Posts
    18

    Default Re: Mike Dude's HK-Drone Version 2 RELEASE

    Awesome mike ^^
    one cookie for you

    => TO emspike

    i think your e2 contain some little errors....
    but i'll give you a too ^^
    Yup, Earth is very dangerous, go back to Mars

  3. #13
    Wire Noob Sly_Ripper's Avatar
    Join Date
    Mar 2010
    Posts
    6

    Default Re: Mike Dude's HK-Drone Version 2 RELEASE

    Quote Originally Posted by emspike View Post
    Heres the flight expression optimized (out of game, if I accidentally f'd something up tell me). I think I got everything.

    PHP Code:
    @name HK-Drone V2
    @inputs [RPod LPod APod]:entity Pod:wirelink
    @outputs RThrust LThrust AThrust Altitude Angles:angle HoverThrust RPitch LPitch APitch Ground
    @persist RPitch LPitch TZ Altitude Roll Pitch ForwardVel SideVel RPodChange LPodChange
    @persist AngVel SpeedCounter SpinCounter Bank Acc Right Left APitch UpsideDown Torque
    @persist [Self Base]:entity

    interval
    (50)

    if(
    first()){
        
    Self entity()
        
    Altitude=Self:pos():z()
        
    Base Self:isWeldedTo()
        
    rangerHitWater(1)
        
    rangerFilter(Base)
        
    rangerPersist(1)
    }


    Active=Pod["Active"]
    W=Pod["W",number]
    A=Pod["A",number]
    S=Pod["S",number]
    D=Pod["D",number]
    Mouse1=Pod["Mouse1",number]
    Mouse2=Pod["Mouse2",number]
    R=Pod["R",number]
    Space=Pod["Space",number]
    Shift=Pod["Shift",number]
    Alt=Pod["Alt",number]
    Driver=Pod["Entity",number]:driver()
    AimPos=Pod["AimPos",number]
    Bearing=Pod["Bearing",number]
    Elevation=Pod["Elevation",number]

    ###Minimum Height

    Ground rangerOffset(64000,Self:pos(),vec(0,0,-1)):position():z()+40

    ###Flying Altitude

    if(!Active){
        
    Altitude=Self:pos():z()
        
    RPitch=UpsideDown*RPod:angles():pitch()
        
    LPitch=UpsideDown*LPod:angles():pitch()
        
    APitch=UpsideDown*APod:angles():pitch()
        
    RPod:applyAngForce(ang(RPitch+$RPitch*4,0,0)*20)
        
    LPod:applyAngForce(ang(LPitch+$LPitch*4,0,0)*20)
        
    APod:applyAngForce(ang(APitch+$APitch*4,0,0)*20)
        
    RThrust=0
        LThrust
    =0
        AThrust
    =0
    }
    else{
        if(
    Shift){
            
    Altitude=clamp(Altitude+3,Ground,999999999)
        }elseif(
    Space){
            
    Altitude=clamp(Altitude-3,Ground,999999999)
        }
        
    ###Maintain Altitude
        
        
    Self:pos():z()
        
    TZ = (-Altitude)
        
    HoverThrust=(TZ+$TZ*10)
        
        
    ###Angle of Thruster Pods
        
        
    if(abs(Pitch)>90){
            
    UpsideDown=-1
        
    }else{
            
    UpsideDown=1
        
    }
        
    GoAngle=40*(S-W)
        
    TurnAngle=20*(D-A)
        
        
    RPitch=clamp((RPod:angles():pitch()+GoAngle+TurnAngle+SpeedCounter+SpinCounter),-90,90)
        
    LPitch=clamp((LPod:angles():pitch()+GoAngle-TurnAngle+SpeedCounter-SpinCounter),-90,90)
        
    APitch=clamp((APod:angles():pitch()+GoAngle+SpeedCounter),-90,90)
        
    RPod:applyAngForce(ang(RPitch*1+$RPitch*4,0,0)*180)
        
    LPod:applyAngForce(ang(LPitch*1+$LPitch*4,0,0)*180)
        
    APod:applyAngForce(ang(APitch*1+$APitch*2,0,0)*180)
        
        
    ###Hover Balance
        
        
    SelfAngs Self:angles()
        
    Angles=SelfAngs
        Roll
    =SelfAngs:pitch()
        
    Pitch=SelfAngs:roll()
        
    RollCounter=(Roll+$Roll*3)*3
        PitchCounter
    =(Pitch+$Pitch*2)*4
        StrafeCounter
    =(SideVel+$SideVel*0.25)/2+1.25
        
        CosP 
    HoverThrust/cos(Pitch)
        
        
    RThrust=clamp(UpsideDown*(CosP-RollCounter-StrafeCounter),0,200)
        
    LThrust=clamp(UpsideDown*(CosP+RollCounter+StrafeCounter),0,200)
        
    AThrust=clamp(UpsideDown*(CosP-PitchCounter),-100,100)
        
        
    ###Counter Movement
        
        
    if(W|S){
            
    SpeedCounter=0
        
    }else{
            
    SpeedCounter=-(Self:velL():y())/12+0.25
        
    }
        if(
    A|D){
            
    SpinCounter=0
        
    }else{
            
    SpinCounter=(Self:angVel():yaw())/4
        
    }

    There's a few errors with the pod controls. After commenting out the pod controls since they aren't used/needed in the original version, the drone fails to work.

  4. #14
    Wirererer Blaylock1988's Avatar
    Join Date
    Apr 2009
    Location
    North Carolina
    Posts
    280

    Default Re: Mike Dude's HK-Drone Version 2 RELEASE

    lol, that is why I don't clean code outside of gmod. My guess is you removed to many persists. I will take a look at this tomorrow, I don't have time to play gmod today, but thanks for the optimization.

    U.S. Air Force

    Terminator 3 HK-Drone Project
    Download V2 HERE

    New Halo Reach Falcon Project coming soon


  5. #15
    Wirererer Tommyx50's Avatar
    Join Date
    Oct 2007
    Location
    Edinburgh, Scotland
    Posts
    229
    Blog Entries
    1

    Default Re: Mike Dude's HK-Drone Version 2 RELEASE

    I turned it into a transportation robot by removing and changing large parts of the code. And I guess that he did remove to many persists, because parts of the weapons system persists are needed for it to move properly, etc.

    I could put the code on here, but only after it is optimized and working... For some reason the /off command won't turn off the thrusters, but still stop all commands working, and when you fist spawn it on the HK Drone (I used the v1 version of the body but with new code and extra parts) it will fly very high.

    I shall try to fix the problems.

    EDIT :

    I partly fixed it, adding more "if" commands to make it shut down properly, and partly fixed the flying really high... But that seems to be a problem with the props I added, because when I remove them it works(it is a bit confusing, since they were all without a weight, and anti-grav, but still affected it).
    Last edited by Tommyx50; 03-15-2010 at 04:01 PM.
    Expression 3 GATE


    -Something to remember. We cannot see your information through this. Only you (and G. Bush) can.

  6. #16
    Wire Noob Alex912837465's Avatar
    Join Date
    Mar 2010
    Posts
    9

    Default Re: Mike Dude's HK-Drone Version 2 RELEASE

    Wow this is amazing! However i don't know how to spawn it plz help me

  7. #17
    Wire Sofaking emspike's Avatar
    Join Date
    Feb 2008
    Posts
    911

    Default Re: Mike Dude's HK-Drone Version 2 RELEASE

    Quote Originally Posted by Blaylock1988 View Post
    lol, that is why I don't clean code outside of gmod. My guess is you removed to many persists. I will take a look at this tomorrow, I don't have time to play gmod today, but thanks for the optimization.
    I didn't remove any persists or comment out anything. Most of what I did was merging like ifs and simplifying arithmetic.

  8. #18
    ส็็็็็็็็็็็็็็็็ส็็ ็็็็็ Dav1d's Avatar
    Join Date
    May 2009
    Posts
    1,118

    Default Re: Mike Dude's HK-Drone Version 2 RELEASE

    Heyy you finally released this.. Nice.
    Does this use the quats we sorted out or are they for the WIP - HK Aerial?

  9. #19
    Wire Amateur DiscoBiscuit's Avatar
    Join Date
    Mar 2009
    Location
    Summerville, GA
    Posts
    39

    Default Re: Mike Dude's HK-Drone Version 2 RELEASE

    This thing is really cool.

  10. #20
    Wirererer Blaylock1988's Avatar
    Join Date
    Apr 2009
    Location
    North Carolina
    Posts
    280

    Default Re: Mike Dude's HK-Drone Version 2 RELEASE

    Quote Originally Posted by Alex912837465 View Post
    Wow this is amazing! However i don't know how to spawn it plz help me
    You just put it into your Steam\steamapps\username\garrysmod\garrysmod\data\ adv_duplicator folder, load up the game, join a server, pull out your adv duplicator stool, upload it to the server, then load and paste it. Or, just come to Disco's public build server, because it is already uploaded there.

    @Dav1d. No it does not use quaternions, the only thing that does right now is my HK-Aerial that I am working on.

    U.S. Air Force

    Terminator 3 HK-Drone Project
    Download V2 HERE

    New Halo Reach Falcon Project coming soon


Closed Thread
Page 2 of 7 FirstFirst 1234 ... LastLast

LinkBacks (?)

  1. 07-09-2010, 06:12 PM
  2. 03-14-2010, 01:24 AM
  3. 03-13-2010, 11:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots