+ Reply to Thread
Results 1 to 6 of 6

Thread: Perfect angle force?

  1. #1
    Wirererer carocrazy132's Avatar
    Join Date
    May 2009
    Posts
    122

    Default Perfect angle force?

    I've been making some turrets recently, I've noticed they tend to wobble a bit when they get to their destination angle. Does every time of prop with every mass have a perfect amount of force that will send it to it's destination immediately with little to no wobble? Is there an algorithm for figuring out that perfect amount of force?
    http://www.minerwars.com/?aid=1428
    Check out this awesome looking game and help caro in the process :3

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

    Default Re: Perfect angle force?

    What formula are you using? The only one I have used is:

    Code:
    A = E:angles() * Mul
    E:applyAngForce( A + $A * 5 )
    Have a look at this: http://www.wiremod.com/forum/express...pplyforce.html

    Although that tutorial is old, I'd say it is still useful. You should really look into applyTorque though because it has many advantages over this.

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

    Default Re: Perfect angle force?

    Code:
    TargetAngle = Whatever you want
    E = Your entity
    Torque = E:toLocal(rotationVector(quat(TargetAngle)/quat(E))+E:pos())
    E:applyTorque((Torque*1000-E:angVelVector()*20)*E:inertia())
    1: Copy
    2: Paste
    3: Edit TargetAngle & E
    4: ???
    5: Profit
    SVN Tutorial
    My SVN:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    Get dropbox and get 250 MB extra space: Dropbox

  4. #4
    Wirererer carocrazy132's Avatar
    Join Date
    May 2009
    Posts
    122

    Default Re: Perfect angle force?

    Divran - I deem you king of epic copypasta. Every time you help me I never have to do any work XD. Works like a dream, thanks again.
    http://www.minerwars.com/?aid=1428
    Check out this awesome looking game and help caro in the process :3

  5. #5
    Wire Noob Axelnemeth's Avatar
    Join Date
    Apr 2009
    Posts
    26

    Default Re: Perfect angle force?

    I was about to post, when I saw Divran's code.
    My turret always flipped when I crossed the right side of the map with my mouse.
    Too bad I cannot fathom what the quaternion stands for.

    kudos

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

    Default Re: Perfect angle force?

    Added to FAQ.

+ Reply to 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