+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: owner():pos()

  1. #1
    Wire Amateur Frechetta93's Avatar
    Join Date
    Nov 2008
    Posts
    39

    Default owner():pos()

    This is definitely wrong, and there probably must be more added to this. But i'm trying to make a handheld flamethrower using applyForce and I just get the jist of it. What I have now is this:

    Code:
    interval(10)
    applyForce((owner():pos())*entity():mass()*10)
    What it does is not follow me, but it has downward thrust. When I throw it up into the air, it rockets back down to the ground. Help?

  2. #2
    Expressionism 2.0 Syranide's Avatar
    Join Date
    Mar 2007
    Location
    Sweden
    Posts
    4,573

    Default Re: owner():pos()

    applyForce doesn't take a world position (like pos), it takes a direction (like eye()).

    Meaning that you need to take the position you want it to be at, and then the position where it currently is, and subtract those two, then you get a direction.

    EDIT: Also, use runOnTick(1) instead of interval(10)

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

    Default Re: owner():pos()

    Damn, Syr beat me

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

    Default Re: owner():pos()

    Quote Originally Posted by Frechetta93 View Post
    This is definitely wrong, and there probably must be more added to this. But i'm trying to make a handheld flamethrower using applyForce and I just get the jist of it. What I have now is this:

    Code:
    interval(10)
    applyForce((owner():pos())*entity():mass()*10)
    What it does is not follow me, but it has downward thrust. When I throw it up into the air, it rockets back down to the ground. Help?
    Do this

    @outputs V:vector Mul

    runOnTick(1)

    Mul = entity():mass()

    V = owner():shootPos - entity():massCenter()

    applyForce(V*Mul*10 + $V*Mul*20)


    # THis should work just fine

  5. #5
    Wire Amateur Frechetta93's Avatar
    Join Date
    Nov 2008
    Posts
    39

    Default Re: owner():pos()

    I tested both and I got it to work with both:
    Code:
    runOnTick(1)
    applyForce((entity():pos()-owner():shootPos())entity():mass()*10)
    Code:
    @outputs V:vector Mul
    
    runOnTick(1)
    
    Mul = entity():mass()
    
    V = owner():shootPos - entity():massCenter()
    
    applyForce(V*Mul*10 + $V*Mul*20)

    But now I need it to stay in place because it keeps on going past me and then coming back and passing me again. And I need it to aim where i'm aiming. This happens for both. How would I manage to fix this?
    Last edited by Frechetta93; 03-24-2009 at 03:51 PM.

  6. #6
    Wire Amateur Frechetta93's Avatar
    Join Date
    Nov 2008
    Posts
    39

    Default Re: owner():pos()

    So how would I make it aim where I look?

  7. #7
    Wire Amateur Tangoz's Avatar
    Join Date
    Feb 2009
    Location
    California
    Posts
    66

    Default Re: owner():pos()

    Quote Originally Posted by Frechetta93 View Post
    I tested both and I got it to work with both:
    Code:
    runOnTick(1)
    applyForce((entity():pos()-owner():shootPos())entity():mass()*10)
    Code:
    @outputs V:vector Mul
    
    runOnTick(1)
    
    Mul = entity():mass()
    
    V = owner():shootPos - entity():massCenter()
    
    applyForce(V*Mul*10 + $V*Mul*20)

    But now I need it to stay in place because it keeps on going past me and then coming back and passing me again. And I need it to aim where i'm aiming. This happens for both. How would I manage to fix this?
    Check this thread out. Someone had the same problem.

    My favorite code from that thread:
    Quote Originally Posted by chinoto View Post
    Code:
    @inputs TargVec:vector
    interval(10)
    EE=entity()
    applyForce(((TargVec-EE:pos())*10-EE:vel())*EE:mass())
    Don't multiply vel.

  8. #8
    Wire Amateur Frechetta93's Avatar
    Join Date
    Nov 2008
    Posts
    39

    Default Re: owner():pos()

    To make it aim, would I use applyOffsetForce()? If so, how would I utilize it?

  9. #9
    Wire Amateur Frechetta93's Avatar
    Join Date
    Nov 2008
    Posts
    39

    Default Re: owner():pos()

    See, i'm trying to use applyAngForce to the pitch and yaw of where i am aiming. For example:
    Code:
    interval(10)
    E=entity()
    Pitch = ang(owner():aimPos()):pitch()
    Yaw = ang(owner():aimPos()):yaw()
    Ang = ang(Pitch, Yaw, 0)
    applyAngForce((ang(EE:pos())-Ang))
    There is more code to it, the part to make it follow me, but when i apply this, the cube spins around in all crazy directions. (The expression is the model of a cube)

  10. #10
    Wire Amateur Frechetta93's Avatar
    Join Date
    Nov 2008
    Posts
    39

    Default Re: owner():pos()

    Anything? I really need some help with this.

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Ranger - output prop owner ID
    By Beer in forum Ideas & Suggestions
    Replies: 1
    Last Post: 11-04-2008, 03:52 PM
  2. Do not target owner. HA!
    By Dude in forum Installation and Malfunctions Support
    Replies: 12
    Last Post: 05-30-2007, 02:10 PM

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