Page 1 of 2 12 LastLast
Results 1 to 10 of 12
Like Tree9Likes

Thread: E2 how do u make something hover ?

  1. #1
    Wire Noob ianohend99's Avatar
    Join Date
    Apr 2011
    Posts
    11

    Default E2 how do u make something hover ?

    Im haveing trouble,im wanting to make a fighter,or something like that im having trouble trying to find out a way to make it float. Can someone help me thanks.

  2. #2
    Developer Jack37's Avatar
    Join Date
    Jul 2009
    Location
    Slovakia
    Posts
    1,275

    Default Re: E2 how do u make something hover ?

    Look for applyForce() function. There are tutorials and many examples of it.


  3. #3
    Wire Sofaking postman's Avatar
    Join Date
    Mar 2010
    Location
    oregon
    Posts
    1,089

    Default Re: E2 how do u make something hover ?

    I presume you're new to wiremod, so this probably wont do you any good, but others looking at this thread in the future may.

    First you create a ranger, using "rangerOffset(argument 1, argument 2, argument 3)"
    Code:
    Rng = rangerOffset()
    The first argument, a number of how long your ranger is, which has to be longer then your hover height.
    The second argument of the ranger the prop you want to hover's position.
    The third argument is the prop's down direction (Prop:up()*-1) or (-Prop:up())

    Giving you:
    Code:
    Rng = rangerOffset(100,Prop:pos(),-Prop:up())
    You also need to filter the prop that will be hovering from the ranger's view, as the ranger will hit it.
    Code:
    rangerFilter(Prop)
    Then you need to detect when the ranger hits something, and in that statement you will make the prop go upwards.
    Code:
    if (Rng:hit()) 
    {
    }
    The amount of upward thrust is determined by subracting the ranger's distance by the height you want to hover at.
    Code:
    Diff = 40-Rng:distance()
    then you apply your force in the same statement:
    Code:
    Prop:applyForce((vec(0,0,Diff)*20-Prop:vel())*35)
    *the apply force code can be changed, this is just what i use*


    The final code being:
    Code:
    rangerFilter(Prop)
    Rng = rangerOffset(100,Prop:pos(),-Prop:up())
    
    if (Rng:hit()) 
    {
          Diff = 40-Rng:distance()
          Prop:applyForce((vec(0,0,Diff)*20-Prop:vel())*35)
    }
    Hope that helps SOMEONE, at least
    Last edited by postman; 12-14-2011 at 09:34 AM.

  4. #4
    Ursus maritimus Drunkie's Avatar
    Join Date
    Feb 2009
    Location
    Canada
    Posts
    6,675
    Blog Entries
    1

    Default Re: E2 how do u make something hover ?

    1. Open physical properties tool
    2. Uncheck gravity
    3. Click on the prop.

  5. #5
    Wire Sofaking postman's Avatar
    Join Date
    Mar 2010
    Location
    oregon
    Posts
    1,089

    Default Re: E2 how do u make something hover ?

    Quote Originally Posted by Drunkie View Post
    1. Open physical properties tool
    2. Uncheck gravity
    3. Click on the prop.
    Lol.

  6. #6
    Hickley's Avatar
    Join Date
    Apr 2010
    Location
    UK
    Posts
    1,360
    Blog Entries
    5

    Default Re: E2 how do u make something hover ?

    Quote Originally Posted by postman View Post
    Lol.
    Problem? It works.
    Drunkie likes this.


  7. #7
    Wire Noob ianohend99's Avatar
    Join Date
    Apr 2011
    Posts
    11

    Default Re: E2 how do u make something hover ?

    Post man, as much as im new to wiremod.com, im not new to e2 and certinly not new to apply force i do get it,but i havent tried the built in ranger function yet.Now i might give it a try.

  8. #8
    has a custom title mattwd0526's Avatar
    Join Date
    Apr 2009
    Posts
    2,817

    Default Re: E2 how do u make something hover ?

    Quote Originally Posted by ianohend99 View Post
    Post man, as much as im new to wiremod.com, im not new to e2 and certinly not new to apply force i do get it,but i havent tried the built in ranger function yet.Now i might give it a try.
    Glaring spelling mistake aside, you claim to be very familiar with applyForce, and yet you made a thread asking how to make things float with E2.

  9. #9
    Wire Tutor chinoto's Avatar
    Join Date
    Apr 2008
    Location
    Brooklyn Park, MN. Lost my thumbdrive yet again...
    Posts
    1,977

    Default Re: E2 how do u make something hover ?

    This is one of my toys, it tries to defy/cancel/negate gravity on props aka make 'em float.
    Defy Gravity (by chinoto)
    PHP Code:
    @name Defy Gravity
    @inputs Stop
    @outputs Count1 Count2
    @persist A1:array A2:array Find
    runOnTick
    (1)
    if (
    findCanQuery()) {
        
    Find=(Find+1)%2
        findClearBlackList
    (),findClearWhiteList()
        
    findIncludePlayerProps(owner())
        if (
    Find==0) {
            
    findByClass("prop_physics")
            
    A1=findToArray()
        }
        if (
    Find==1) {
            
    findByClass("sent_ball")
            
    A2=findToArray()
        }
    }

    if (!
    Stop) {
        
    Gravity=vec(0,0,9.015)
        
    Count1=A1:count()
        
    T=0
        
    while ((T<Count1)&(minquota()>100)) {
            
    T++,TE=A1[T,entity]
            
    TE:applyForce((Gravity-TE:vel()/100)*TE:mass())
        }

        
    Count2=A2:count()
        
    T=0
        
    while ((T<Count2)&(minquota()>100)) {
            
    T++,TE=A2[T,entity]
            
    TE:applyForce((Gravity-TE:vel()/100)*TE:mass())
        }

    If it looks bad for some reason, that's because it is rather old and not updated, will be fixing up the examples page soon
    (\__/) Expression 2 Resources: E2 Beginner's Guide | E2 Formatting Guide | E2 Function Reference | E2 Examples | Me
    (='.'=) PM me code and I'll send it back optimized if possible. (Can't do much for EGP code though, haven't learned it)
    (")_(") Drunkie referring to an E2: "It's obvious that Chinoto made this, his coding style is all over it."

  10. #10
    Wirererer cooldudetb's Avatar
    Join Date
    Sep 2008
    Location
    UK
    Posts
    263

    Default Re: E2 how do u make something hover ?

    Levitation can only be achieved by correct spelling and grammar in your post. Only then may you become a master of the apple force.
    Last edited by Dav1d; 07-30-2011 at 10:34 AM. Reason: ftfy
    Drunkie, Dav1d, mrBuBB13s and 1 others like this.
    [E2] Extended Timers

    Bulls pro-tip of the day:
    When you honestly think that Led3=1,0,1,0,1,0,1 can make a light blink, stop trying to make an OS and do something easier.

Page 1 of 2 12 LastLast

Posting Permissions

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