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

Thread: applyOffsetForce for aim?

  1. #1
    Wire Sofaking vexx21322's Avatar
    Join Date
    Dec 2008
    Location
    Co, united states
    Posts
    424

    Default applyOffsetForce for aim?

    How can I apply applyOffsetForce() to aim a barrel?


    I want to aim the up() of the barrel at my aim with applyOffsetForce()
    Last edited by Magos Mechanicus; 02-08-2010 at 03:33 AM. Reason: Merging doublepost
    Have you checked HERE first?

  2. #2
    Master of Mars Magos Mechanicus's Avatar
    Join Date
    May 2008
    Posts
    852

    Default Re: applyOffsetForce for aim?

    I'd suggest trying the applyTorque method. It's great for when you have a direction vector you want to aim in some direction.
    I can wire anything directly into anything! I'm the Professor!
    -Professor Hubert Farnsworth

  3. #3
    Wire Sofaking vexx21322's Avatar
    Join Date
    Dec 2008
    Location
    Co, united states
    Posts
    424

    Default Re: applyOffsetForce for aim?

    I don't think that will work.
    Have you checked HERE first?

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

    Default Re: applyOffsetForce for aim?

    applyOffsetTorque would have been handy for something like this.

  5. #5
    Wire Sofaking vexx21322's Avatar
    Join Date
    Dec 2008
    Location
    Co, united states
    Posts
    424

    Default Re: applyOffsetForce for aim?

    Can you help me understand how to use it?
    Have you checked HERE first?

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

    Default Re: applyOffsetForce for aim?

    Quote Originally Posted by vexx21322 View Post
    Can you help me understand how to use it?

    It does not exist at the moment.

  7. #7
    No u Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    4,576

    Default Re: applyOffsetForce for aim?

    Quote Originally Posted by vexx21322 View Post
    I don't think that will work.
    Yes it will.

    Code:
    Mul1 = 1000
    Mul2 = 20
    TargetAngle = (owner():aimPos() - E:pos()):toAngle() + ang(90,0,0) #<- notice +ang 90 will make it aim with the UP dir. (Edit: or maybe - ang 90)
    Torque = E:toLocal(rotationVector(quat(TargetAngle) / quat(E))+E:pos())
    E:applyTorque((Torque*Mul1-E:angVelVector()*Mul2)*E:inertia())
    SVN Tutorial
    My SVN:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    Get dropbox and get 250 MB extra space: Dropbox

  8. #8
    Wire Sofaking vexx21322's Avatar
    Join Date
    Dec 2008
    Location
    Co, united states
    Posts
    424

    Default Re: applyOffsetForce for aim?

    Haha, I understood till the 4th line. Mind explaining what quat() and some others do?
    Have you checked HERE first?

  9. #9
    Wire Noob lollybobi's Avatar
    Join Date
    Aug 2009
    Posts
    19

    Default Re: applyOffsetForce for aim?

    I would solve it with setAng(), as this will be more acurrate and wont fail at all.

    I personally don't like to do aiming with force, as it's not 100% acurrate

  10. #10
    No u Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    4,576

    Default

    Quote Originally Posted by vexx21322 View Post
    Haha, I understood till the 4th line. Mind explaining what quat() and some others do?
    Go look at the applyTorque tutorial. I only posted that messy code because I assumed you had already read the tutorial so that you would understand it (at least somewhat understand it...).

    Quote Originally Posted by lollybobi View Post
    I personally don't like to do aiming with force, as it's not 100% acurrate
    Orly. (Tip: fullscreen)
    Extremely fucking accurate turret - Xfire Video

    Edit: Oops double post.
    Last edited by Magos Mechanicus; 02-08-2010 at 08:03 AM. Reason: Oops indeed.
    SVN Tutorial
    My SVN:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    Get dropbox and get 250 MB extra space: Dropbox

+ Reply to Thread
Page 1 of 2 12 LastLast

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