Rotation in Forge (Useful Information)

Discussion in 'Halo and Forge Discussion' started by ao6Adam, Oct 20, 2010.

  1. ao6Adam

    ao6Adam Forerunner

    Messages:
    22
    Likes Received:
    0
    This is my first post on Forge Hub so please bear with me :)

    Enclosed is the backstory and formula
    For some time now I have been bothered by the rotation of objects in forge 2.0. If you are building a ramp that isn't in line with the x or y axis then when you tilt it up it will go diagonal. After some experimentation I've found out that it is because forge renders objects by performing the Roll, then the Pitch, then the Yaw. This means that creating a ramp that is not parallel to an axis can be problematic at best.

    Being a mathematician at heart I was determined that there must be a way to convert the angles I wanted in my head to the angles used by forge's implementation of Yaw, Pitch and Roll. After much searching on the subject of rotations in 3D and Euler angles I have come up with a formula to convert the angle system I want to use in to forge's angle system.

    The angle system I find myself thinking of would work like this:
    Rotate (Yaw) the object till its facing the direction you want, pull back(Pitch) until its at the angle you want and then spin the object to the appropriate slant (A second yaw). This is most useful if you with to create a banked corner for example or a spiral where you may want the slant(what I would call pitch) to be 30 degrees towards the middle of the corner. The last angle (second yaw) would then control the angle that the corner would be decreasing at.

    I feel that the system I described is most useful when making race tracks. These are the rather complicated formulae I have come up with to convert between my system and forge's (P.S. Link to excel file at bottom of post):
    a = Cos((Pi() * MyYaw1)/180) * Sin((Pi() * MyPitch)/180)
    b = Cos((Pi() * MyPitch)/180) * Cos((Pi() * MyYaw1)/180)
    c = Cos((Pi() * MyPitch)/180)

    Pitch = 180 * ASin(a) / Pi()
    Yaw = -Sign(Sin((Pi() * MyYaw1)/180)) * 180 * ACos(b * Sec((Pitch * Pi())/180)) / Pi() + MyYaw2
    Roll = -Sign(Sin((Pi() * MyYaw1)/180)) * 180 * ACos(c * Sec((Pitch * Pi())/180)) / Pi()

    MyYaw1 is the direction the ramp will face.
    MyPitch is the angle it will slant at.
    MyYaw2 is the tilt the object will have (useful for slanted banked track such as spirals).

    The Sign() function just gives a plus or a minus depending whether the thing inside it is positive or negative. For example Sign(-10)=-1, Sin(3.4) = 1, Sign(-1.23) = -1, Sign(12345) = 1, etc.

    Pitch, Yaw and Roll are what you would then enter in forge coordinate editing to make the piece angled as you would like.
    EXAMPLE OF IT APPLIED
    [​IMG]

    EXAMPLE MAP
    Bungie.net : Halo Reach : File Details

    STEP BY STEP
    [​IMG]
    First lay out your circle or corner In this example I decided to use 8 pieces turning around a full circle. A full circle is 360° so each piece will be rotated by 360°/8 = 45° from the last piece. So the first piece is at 0°, the second at 0° + 45° = 45°, the third at 45°+45°= 90°, etc.

    [​IMG]
    This is what we'd like to be able to do, pull each piece back by 30° to get our circle, but just look at all the diagonal pieces, they're clearly not straight! Here are some more pictures showing this:

    [​IMG]
    [​IMG]
    So what can we do?

    Ok so the 45°, 135°, 225° and 315° pieces are clearly wrong, to fix it lets use the spread sheet. Ok our first angle is how much each piece is spun around so were going to want to use 45°, 135°, 225° and 315°. Then were going to want to tilt back by 30°. And lastly this is a level curve (the height doesn't change as we turn) so the last angle is 0°.
    Putting those numbers in excel gives us (21,-49,-22), (-21,-131,-22), (-21,131,22), (21,49,22), each set of 3 numbers is the (Pitch, Yaw, Roll) for each of those blocks.
    Lets put those numbers in forge and look at the slants now.....

    [​IMG]
    [​IMG]

    Now all you'd have to do is fit the pieces together. I'll let you figure that out :)


    EXAMPLE- 30 degree banked circle with 'n' amount of sides
    n=4. (30,0,0), (0,-90,-30), (-30,0,0), (0,90,30).
    n=5. (30,0,0), (9,-74,-29), (-24,-140,-19), (-24,140,19), (9,74,29).
    n=6. (30,0,0), (14,-63,-27), (-14,-117,-27), (-30,0,0), (-14,117,27), (14,63,27).
    n=7. (30,0,0), (18,-55,-24), (-6,-101,-29), (-27,-151,-14), (-27,151,14), (-6,101,29), (18,55,24).
    n=8. (30,0,0), (21,-49,-22), (0,-90,-30), (-21,-131,-22), (-30,0,0), (-21,131,22), (0,90,30), (21,49,22).
    n=9. (30,0,0), (23,-44,-20), (5,-81,-30), (-14,-117,-27), (-28,-157,-11), (-28,157,11), (-14,117,27), (5,81,30), (23,44,20).
    n=10. (30,0,0), (24,-40,-19), (9,-74,-29), (-9,-106,-29), (-24,-140,-19), (-30,0,0), (-24,140,19), (-9,106,29), (9,74,29), (24,40,19).
    n=11. (30,0,0), (25,-37,-17), (12,-68,-28), (-4,-97,-30), (-19,-127,-24), (-29,-161,-9), (-29,161,9), (-19,127,24), (-4,97,30), (12,68,28), (25,37,17).
    n=12. (30,0,0), (26,-34,-16), (14,-63,-27), (0,-90,-30), (-14,-117,-27), (-26,-146,-16), (-30,0,0), (-26,146,16), (-14,117,27), (0,90,30), (14,63,27), (26,34,16).
    [size=+1]EXCEL SPREADSHEET, WITH ROTATION FORMULAE, MAP REFLECTION FORMULAE, AND MAP ROTATION FORMULAE. (Version 1.2)
    [/size]

    WHAT ELSE IS IN THE SPREADSHEET
    There is a formula to rotate a piece around a specific point. So if you have a 4 way symmetrical map, you can take a piece, and rotate it around the center so it will be in the exact same position relative to the point, but rotated around that point (Think Sanctuary/Asylum or Wizard/Warlock).

    There is also a reflection formula, where you can place a piece, and than reflect it across an axis, so it will be in the exact same position relative to the line and the exact same distance away. Useful for symmetrically reflected maps (Think Sidewinder, Avalanche, Narrows, The Pit or Midship).
     
    #1 ao6Adam, Oct 20, 2010
    Last edited: Nov 2, 2010
  2. Avolanty

    Avolanty Forerunner

    Messages:
    47
    Likes Received:
    0
    I just use edit coordinate and bypass the math, if you want a specific angle from the previous ramp click edit coordinates on the previous one and copy down the pitch roll yaw. Then rotate -180 or whatever from the opposing ramp. Its not really as hard as your making it out to be
     
  3. Hippie Gamer

    Hippie Gamer Forerunner

    Messages:
    64
    Likes Received:
    0
    and the dbag award of the day goes to..............

    -Adam dont worry about him, i liked what you did (mathematician myself) great discovery :)
     
  4. Katanga

    Katanga Ancient
    Senior Member

    Messages:
    1,090
    Likes Received:
    91
    Let's break out a calculator and do some beastly forging :D
     
  5. Avolanty

    Avolanty Forerunner

    Messages:
    47
    Likes Received:
    0
    Well excuse me Einstein but I don't need to be told how to scientifically throw a rock....

    I was just stating this is a simpler way to use the coordinates for people less scientific about the game and more about design.
    I do compliment the efforts put in to try to understand this but its likely to confuse the average reader, how about simplifying it down a notch. (not saying I'm stupid) just saying that I do things fast and easy.
    Especially when it comes to forge, you could have everything perfectly measured but the map could totally suck. Its better to build the map close to what you want and then finite later(using the methods that this intelligent person discovered).
    If you tell a fellow forger that this is the only way to get it done, then your only complicating his creative thinking at the start. My way was to just simplify and get the forger to move on. How many people would play with this after reading it, a few but it would discourage a lot from trying.
    Remember a lot of people don't like math.
    I hate complicated math like statistics, but love Geometry and Trig.
    So sorry that I disturbed the idea of making Forge World into the Vulcan Science Academy that you race around in with mongooses.
     
    #5 Avolanty, Oct 20, 2010
    Last edited: Oct 20, 2010
  6. ao6Adam

    ao6Adam Forerunner

    Messages:
    22
    Likes Received:
    0
    I only wish it was this easy. If you have something that doesn't lie on any axis then none of roll, pitch or yaw will spin it around a vertical axis provided you've used pitch or roll, which you would have if your trying to create a ramp :s. That's what makes it so hard to get a ramp right. I mean you can always do it by eye but how many times do you look at it and think, hmm that's not quite right. If those equations were just put in to excel you could get the exact pitch/yaw/roll in a second and change the coordinates. I might create an excel sheet for people who get scared by math so they don't go running off :) thanks for the insight about peoples reactions though.
     
    #6 ao6Adam, Oct 20, 2010
    Last edited: Oct 20, 2010
  7. Angel of Grief

    Angel of Grief Forerunner

    Messages:
    243
    Likes Received:
    0
    You sir, are a genius. If only I liked math a bit more (I stopped after getting through Calc II), then I could truly appreciate this. But this actually saved my map, so thank you for your brilliance.
     
    #7 Angel of Grief, Oct 20, 2010
    Last edited: Oct 20, 2010
  8. Avolanty

    Avolanty Forerunner

    Messages:
    47
    Likes Received:
    0
    Now your talking I can see that spread sheet being of more use now
     
  9. Titmar

    Titmar Le Mar du Teet
    Senior Member

    Messages:
    4,020
    Likes Received:
    14
    great discovery.

    whenever i have been having trouble with this, i've found that going back to doing it the old school way still works great as well. (bracing objects and free rotating)
     
  10. Insane54

    Insane54 Ancient
    Senior Member

    Messages:
    6,028
    Likes Received:
    10
    Great job, Adam....this is definitely a great tool for any forger.

    Hopefully this gets some attention from the staff, as well :)
     
  11. xWooden leafx

    xWooden leafx Ancient
    Senior Member

    Messages:
    1,316
    Likes Received:
    0
    this is pretty sweet dood.
    thanks a lot, i was actually thinking of putting the time into it myself. sticky?
    i will definitely use it, anyone here test it out yet? i dont currently have an xbox, so yeah. i was annoyed with all of the problems ramps were causing me though.
     
  12. Exuberance

    Exuberance Forerunner

    Messages:
    4
    Likes Received:
    0
    Thanks. This saves me some time trying to figure this out myself. Their method works good in certain cases, but almost always I want the much more sensible standard version of rotation. The one that actually makes sense.
     
  13. Angel of Grief

    Angel of Grief Forerunner

    Messages:
    243
    Likes Received:
    0
    I used it on my current map, and it worked very well. It can be a little confusing when you're trying to rotate an object that isn't in it's default orientation (upside down for example).
     
  14. Avolanty

    Avolanty Forerunner

    Messages:
    47
    Likes Received:
    0
    Dont mean to make you do extra work but...

    Ive been testing out the coordinates and this might divide the formulas up easier
    Having a 30 degree slope(roll is 30) on a normal wall. With pitch and yaw both at zero.
    To make a 45 degree rotation(yaw at 45) from that slope with another wall instead change roll to 15 and pitch to -15 to keep the slope. Then to make a wall connected to this 45 degree wall at a 90 degree(yaw) just change the pitch to -30 and leave roll at 0 to keep the same slope.

    Basically in between 90 degree changes on the x just adjust for the 45 degree at half the value of what your intending slope is between roll and pitch. Then anything in between 45 and 90 keep an even balance of positive and negative. Is there like a spreadsheet you can make demonstrating this on how to keep your slope consistent?

    By the way pitch and roll are opposite when changing x from 0 to 90.

    x is describing how the wall stands with a slope, or your rotation snap.
     
    #14 Avolanty, Oct 20, 2010
    Last edited: Oct 20, 2010
  15. kevinb1231996

    kevinb1231996 Ancient
    Senior Member

    Messages:
    89
    Likes Received:
    0
    adam, you are a god.
    i was going to start working some sort of formulae out at some point, but this is perfect, the spreadsheet and everything!

    good job.
     
  16. pyro

    pyro The Joker
    Senior Member

    Messages:
    3,703
    Likes Received:
    4
    So this is just a complicated way of saying change the incline in whichever direction you want, then spin it around horizontally?
    Have you ever heard of occam's razor?
    [​IMG]
     
    #16 pyro, Oct 20, 2010
    Last edited: Oct 20, 2010
  17. Confetti

    Confetti Forerunner

    Messages:
    5
    Likes Received:
    0
    WTF? I have never seen this kind of mathmatical equations like this unless in my teacher's book!

    can someone maybe make this a little simpler since i aint a pro learner?
     
  18. Angel of Grief

    Angel of Grief Forerunner

    Messages:
    243
    Likes Received:
    0
    Just download his excel spread sheet, and it becomes much easier (you don't have to understand the math anymore).
     
  19. Rorak Kuroda

    Rorak Kuroda Up All Night
    Forge Critic Senior Member

    Messages:
    1,923
    Likes Received:
    10
    Yeah, it is, but it's really nice to understand why it works the way it does. Though, I'm no mathematician, and I'd adore you if you could create a video clip of this. I can't seem to retain any information by reading, a video tutorial would be greatly appreciated. Not only that, but if you organize your post and create a video tutorial, I'd highly recommend that this thread be posted in the Reach's Forging 101. Or sticked in whatever appropriate area.
     
  20. Confetti

    Confetti Forerunner

    Messages:
    5
    Likes Received:
    0
    what excel spread sheet? i dont see it
     

Share This Page