+ Reply to Thread
Page 7 of 8 FirstFirst ... 5678 LastLast
Results 61 to 70 of 76
Like Tree4Likes

Thread: applyTorque Tutorial

  1. #61
    Wire Sofaking Fizyk's Avatar
    Join Date
    Jun 2008
    Location
    Łomianki, Poland
    Posts
    740
    Blog Entries
    1

    Default Re: applyTorque Tutorial

    Great ideas, nescalona. I edited the tutorial and included them. Thanks!

    My programs: BIOS - Alcyone - Calculator - Notepad - Movie Player
    My tutorials: applyTorque - Quaternions - PID controllers
    Some other things I made: FT Chip - RK4 Solar System

  2. #62
    Wire Amateur perlm's Avatar
    Join Date
    Jul 2010
    Location
    Sweden
    Posts
    73

    Default Re: applyTorque Tutorial

    Quote Originally Posted by Evac View Post
    x,0,0 = Roll
    0,x,0 = Pitch
    0,0,x = Yaw
    Didn't ask for my count.

  3. #63
    Wirererer Neotic's Avatar
    Join Date
    Jul 2008
    Location
    Denmark
    Posts
    130

    Default Re: applyTorque Tutorial

    Gimbal had me locked up tight, but you saved me!

    Thank you dear sir!

  4. #64
    Wire Noob KilleroyCZ's Avatar
    Join Date
    Jul 2011
    Posts
    14

    Default Re: applyTorque Tutorial

    i I am trying to make VTOL, but i am having trouble making side thrusters, when I press W, to set roll to 45 and when unpress to go back to 0, when I tried with
    setAng, it was spinning into 1side of the map.

  5. #65
    Wire Noob elseagoat's Avatar
    Join Date
    Dec 2011
    Posts
    17

    Default Re: applyTorque Tutorial

    I understand torque pretty well (though what is the difference between a moment and toque? is a moment more like applyOffsetForce():? I know a moment is F*D where d is the distance from the point you are taking the moment about and F is force applied perpendicularly to the distance D, and the moment acts about an axis perpendicular to the plane the force vector and the distance create, AKA cross product.)

    But what benefits does using applyToque(): have over using applyAngForce():? Why use one or the other instead of the alternative? I have had lots of issues with applyAngForce freaking out on my prop and I was hoping that maybe the answer to this would enlighten me as to why. Seriously, getting a 2x2 phx box to simply stay upright, adjust its bearing to face something, and tilt to have a certain angle so I can mount a pewpew gun on it is extremely difficult, without the right constants, it basically sends the prop into a complete spaz every time.

  6. #66
    ส็็็็็็็็็็็็็็็็ส็็ ็็็็็ Dav1d's Avatar
    Join Date
    May 2009
    Posts
    1,118

    Default Re: applyTorque Tutorial

    The difference between a moment and torque is that torque is a couple; two forces of equal magnitude in opposite directions acting on one object.
    The only real difference is that torque rotates without adding any linear velocity, whereas an offset force or a moment that doesn't have an opposing force will add linear velocity as well as rotational.

    applyTorque doesn't suffer from gimbal lock like applyAngForce can, due to it not using angles.

  7. #67
    hurrr physics Tolyzor's Avatar
    Join Date
    Aug 2008
    Location
    England
    Posts
    1,019

    Default Re: applyTorque Tutorial

    Quote Originally Posted by Dav1d View Post
    applyTorque doesn't suffer from gimbal lock like applyAngForce can, due to it not using angles.
    That depends entirely on how you use each of them. Both applyTorque & AngForce use a pseudo vector input 'V';

    Code:
    applyTorque(V)
    # is equivalent to
    applyAngForce(ang(shiftR(V)))
    V is a vector in either the (p, y, r) or (x, y, z) co-ordinate system that describes a 3d unit length axis of rotation, multiplied by a scalar magnitude.

    As you can see, ang(pitch, yaw, roll) maps to vec(rotate about local x, rotate about local y, rotate about local z) with a left shift, hence the equivalence shown in the code above.

    This pseudo vector (Euler angle) is fine for specifying a torque, but not sufficient for fully dealing with 3d rotations, since with Euler angles; V =/= Va + Vb, where Va is a rotation (direction vector), Vb is a subsequent rotation (direction vector), and V is the position vector describing the sum of the two rotations. Ergo, rotation concatenation is not possible with Euler angles.

    Therefore, other rotation representations such as matrices or quaternions must be used to deal with rotations in a complete, general manner. If you calculate the required rotation using either of these methods, and then calculate the (Euler angle) torque, either applyTorque or angForce can be used with no gimbal lock issues at all.

    TLDR: If you're having gimbal lock problems I feel bad for you son, I've got 99 problems but 3d Euler angle non-commutativity is not one.
    Last edited by Tolyzor; 2 Weeks Ago at 06:00 AM.
    mattwd0526 and oskar94 like this.
    Comprehensive Gmod physics guide - Ballistic trajectory with drag - Autodyno engine performance test
    Quote Originally Posted by janvos2506 View Post
    i just going to type the code over and over again and maybe il remeber it then
    Don't make the mistake these skydivers did and use any of my Gmod physics models for real life situations...

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

    Default Re: applyTorque Tutorial

    Quote Originally Posted by Tolyzor View Post
    TLDR: If you're having gimbal lock problems I feel bad for you son, I've got 99 problems but 3d Euler angle non-commutativity is not one.
    Wow.
    mattwd0526 likes this.

  9. #69
    Wirererer Snowden42's Avatar
    Join Date
    May 2009
    Posts
    215

    Default Re: applyTorque Tutorial

    Quote Originally Posted by Dav1d View Post
    Two forces of equal magnitude in opposite directions acting on one object.
    If applyTorque operates the same way torque works in the real world, this is completely false. And, in any case, you've effectively described an object at rest (or at constant velocity, but any object inherently requires unbalanced forces to move anyways). Any two forces of equal and opposite magnitude cancel. Newton's First Law says that objects at rest remain at rest unless there are unbalanced forces. If what you've described was actually happening, the forces would be balanced, and there'd be no motion.

    Torque is the product of a force that is acted upon an object perpendicular to the axis about which it rotates and the radius. Alternatively, if the force is known and the angle relative to the vertical is known, then this is a component of the perpendicular force. Use the formula: t=r*F*sin(theta)
    Quote Originally Posted by Echo51 View Post
    Told many people that myself, I feel nooblishious

  10. #70
    Wire Noob elseagoat's Avatar
    Join Date
    Dec 2011
    Posts
    17

    Default Re: applyTorque Tutorial

    I still don't see the advantages of applytoque vs applyangforce?

    Also, when using quaternions, do you simply use quat() instead of vec() and do the rest of the math the same? Can't you jsut avoid gimbal lock with E:toLocal(angles)?
    Last edited by elseagoat; 2 Weeks Ago at 08:33 PM.

+ Reply to Thread
Page 7 of 8 FirstFirst ... 5678 LastLast

Similar Threads

  1. Help with applyTorque
    By AndyDLP in forum Installation and Malfunctions Support
    Replies: 13
    Last Post: 11-16-2009, 12:55 AM
  2. Keep upright with applyTorque() function
    By OmicroN in forum Finished contraptions
    Replies: 2
    Last Post: 07-30-2009, 09:24 AM
  3. E2 Tutorial
    By goluch in forum Gate Nostalgia (Old School Wiring) Discussion & Help
    Replies: 8
    Last Post: 05-28-2009, 02:20 PM
  4. Pac's E2 Tutorial
    By Nicolai1 in forum Gate Nostalgia (Old School Wiring) Discussion & Help
    Replies: 27
    Last Post: 04-12-2009, 08:02 AM
  5. Putting a video tutorial in the gmod tutorial list
    By Def the world in forum Installation and Malfunctions Support
    Replies: 1
    Last Post: 08-21-2007, 10:04 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