+ Reply to Thread
Results 1 to 10 of 10

Thread: Need help with E2 for Observation Drohne

  1. #1
    Wire Noob Nompl's Avatar
    Join Date
    Feb 2010
    Posts
    5

    Question Need help with E2 for Observation Drohne

    I'm new to E2 and only know the basics. I'm currently working on a Chip that turns a Hoverball Prop into a Observation Drohne. I already got the Drohne to fly around with applyForce() but need some help with the following:
    -Can I disalble/enable the Gravitation for the Prop with E2 (Change Physical Proberties)
    -Can I make the entity aim in the same direction like me? (Doesn't aim at the same point like me, aim in the same direction)
    -Is there a script that allows me to use a virtual cam (like the CamController) with E2 so I don't have to use the CamController?
    I already searched for these things but didn't found helpful results, so I'm sorry if these Questions were already answered but I didn't find them. Thanks for reading.

  2. #2
    Wiremod Helper Donkie's Avatar
    Join Date
    May 2008
    Location
    Sweden
    Posts
    1,661

    Default Re: Need help with E2 for Observation Drohne

    1) No.
    2) I believe you want to use the owner():eyeAngles() to do that
    3) No.
    Get out. Seriously, do it.

  3. #3
    Wire Noob Nompl's Avatar
    Join Date
    Feb 2010
    Posts
    5

    Default Re: Need help with E2 for Observation Drohne

    Quote Originally Posted by Donkie View Post
    1) No.
    2) I believe you want to use the owner():eyeAngles() to do that
    3) No.
    Thanks alot

  4. #4
    Wire Noob Nompl's Avatar
    Join Date
    Feb 2010
    Posts
    5

    Default Re: Need help with E2 for Observation Drohne

    Is there any other way to keep a Object in the Air? I already tried to keep something with applyForce() in the air but that conflicts if other apply Force functions running at the sime time for the same object. setMass also doesn't affect the Gravitation so I don't know how to do this.

  5. #5
    Wire Sofaking thetree's Avatar
    Join Date
    Oct 2009
    Location
    England
    Posts
    904

    Default Re: Need help with E2 for Observation Drohne

    Have it in an if statement, so say you wanted to have it flying, then hovering you'd do this


    Code:
    if(Fly == 1) {E:applyForce(whatever)} else {E:applyForce(vec(0,0,E:mass()*9.015))}
    the E:applyForce(vec(0,0,E:mass()*9.015)) bit makes it hover where it is.

    Correct me if I'm wrong anyone.

  6. #6
    Wirererer malum's Avatar
    Join Date
    Feb 2009
    Posts
    217

    Default Re: Need help with E2 for Observation Drohne

    9.015 is the rough formula to "defy gravity". It in no way keeps it in the same location. It actually floats upward a bit.
    Code:
    Vec = (HovHe - Weldedto:massCenter():z())*vec(0,0,1)* 1.35 * Weldedto:mass()
    Weldedto:applyForce(Vec - Weldedto:vel() * 30)
    Works, where HovHe is the z value you want your craft to hover at.

  7. #7
    Wire Noob lilneo's Avatar
    Join Date
    Oct 2009
    Posts
    4

    Default Re: Need help with E2 for Observation Drohne

    Quote Originally Posted by Nompl View Post
    Is there any other way to keep a Object in the Air? I already tried to keep something with applyForce() in the air but that conflicts if other apply Force functions running at the sime time for the same object. setMass also doesn't affect the Gravitation so I don't know how to do this.
    Uh doiii, physical properties? Choose the physical properties tool and uncheck "toggle gravity" and set the properties to whatever you want. Shoot the object and e2 chip on it... Viola, no gravity.

    (As an alternative to using their method)

  8. #8
    Wire Noob Nompl's Avatar
    Join Date
    Feb 2010
    Posts
    5

    Default Re: To some helpfull posts

    Quote Originally Posted by thetree View Post
    Have it in an if statement, so say you wanted to have it flying, then hovering you'd do this


    Code:
    if(Fly == 1) {E:applyForce(whatever)} else {E:applyForce(vec(0,0,E:mass()*9.015))}
    the E:applyForce(vec(0,0,E:mass()*9.015)) bit makes it hover where it is.

    Correct me if I'm wrong anyone.
    I tried this, but the object isn't holdable at a specific ponint. If you move it forward, it hovers up and it conflicts if you give the object another Up/Down command.


    Quote Originally Posted by malum View Post
    9.015 is the rough formula to "defy gravity". It in no way keeps it in the same location. It actually floats upward a bit.
    Code:
    Vec = (HovHe - Weldedto:massCenter():z())*vec(0,0,1)* 1.35 * Weldedto:mass()
    Weldedto:applyForce(Vec - Weldedto:vel() * 30)
    Works, where HovHe is the z value you want your craft to hover at.
    Also I tried this out, but is there any way to do this without giving the Chip the Y-Coordinate where to fly, I mean so you can change the hight by applyForce...Up() and -Up()? With your method it's only possible to do it with changing the coordinates slowly I think. I'll soon post the whole code of the Chip here, so it's maybe easyer to understand my problem, I can't explain it very well because of my limited english knowledge .


    Quote Originally Posted by lilneo View Post
    Uh doiii, physical properties? Choose the physical properties tool and uncheck "toggle gravity" and set the properties to whatever you want. Shoot the object and e2 chip on it... Viola, no gravity.

    (As an alternative to using their method)
    Yes, I know the tools, but I don't know much about E2 so I asked how to do it with E2.

    But thank you all very much for your help.

    EDIT:
    Here's the code. Some parts are in german, sorry. Feel free to use it for fun :

    Code:
    @name KINO
    @outputs KameraAn Pos:vector Angle:angle
    @inputs Objekt:entity An CamAn Front Back Left Right Up Down TurnL TurnR
    @persist Sound SoundType:string HovHe
    #(German:An = English:On)
    #(German:Kamera = English:Camera)
    
    runOnTick(1)
    
    SoundType="npc/dog/dog_idlemode_loop1.wav"
    #EE=findResult(findByModel("models/dav0r/hoverball.mdl"))
    EE=Objekt
    Player=findPlayerByName("Nompl")
    Pos=EE:pos()
    Angle=EE:angles()
    
    #Unsichtbar, wenn Kamera an (Invisible when camera on)
    if(KameraAn != 0)
    {
        EE:setColor(255,255,255,0)
    }
    else
    {
        EE:setColor(255,255,255,255)
    }
    
    #-------------------------------------------------------
    #Basiseinstellungen (Basic setting)
    if(first())
    {
        EE:setMaterial("spacebuild/body")
        EE:setMass(3)
    }
    
    #-------------------------------------------------------
    #Steuerung, wenn das Objekt an ist (Controll when object is on)
    if(An != 0)
    {
        if(Sound == 0)
        {
            Sound=1
            EE:soundPlay(0,0,SoundType)
        }
        KameraAn=CamAn
        
    #-------------------------------------------------------
    #Objekt abbremsen: (Slow down the Object)
        #Abbremsen aller Bewegungen (Slow down all Movements)
        if((Front+Back+Left+Right+Up+Down) == 0)
        {
            EE:applyForce(-(EE:vel())/2)
        }
        #Winkelstabilisierung (Slowdown for rotation)
        if((TurnL+TurnR) == 0)
        {
            EE:applyAngForce(-(EE:angVel())/10)
        }
    
    
    #-------------------------------------------------------
    #Objekt steuern (Controll the Object)
        if(Front != 0)
        {
            EE:applyForce(EE:angles():forward())
        }
        if(Back != 0)
        {
            EE:applyForce(-(EE:angles():forward()))
        }
        if(Right != 0)
        {
            EE:applyForce(EE:angles():right())
        }
        if(Left != 0)
        {
            EE:applyForce(-(EE:angles():right()))
        }
        if(Up != 0)
        {
            EE:applyForce(vec(0,0,5))
        }
        if(Down != 0)
        {
            EE:applyForce(vec(0,0,-5))
        }
        if(TurnL != 0)
        {
            EE:applyAngForce(ang(0,2,0))
        }
        if(TurnR != 0)
        {
            EE:applyAngForce(ang(0,-2,0))
        }
    #-------------------------------------------------------
    }
    else
    {
        KameraAn=0
        Sound=0
        soundStop(0)
    }
    I'm sure it is a terrible code but how I already said, I just started.
    Last edited by Nompl; 04-09-2010 at 08:50 AM. Reason: Adding the E2 Code

  9. #9
    aka Colonel Never Online Colonel Thirty Two's Avatar
    Join Date
    Oct 2009
    Posts
    2,683
    Blog Entries
    5

    Default Re: To some helpfull posts

    I believe Unsmart's server had a entity: propGravity(boolean) function. It might be a part of propcore. If not, I can make it really quick in Lua...

  10. #10
    Wire Noob Nompl's Avatar
    Join Date
    Feb 2010
    Posts
    5

    Default Re: To some helpfull posts

    Quote Originally Posted by initrd.gz View Post
    I believe Unsmart's server had a entity: propGravity(boolean) function. It might be a part of propcore. If not, I can make it really quick in Lua...
    Thanks, it worked. I'll post the whole Code here again, when its done.

    EDIT:
    Here's the upload:
    Last edited by Nompl; 04-24-2010 at 01:42 PM. Reason: Uploaded

+ Reply to Thread

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