Rotation in Forge (Useful Information)

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

  1. xWooden leafx

    xWooden leafx Ancient
    Senior Member

    Messages:
    1,316
    Likes Received:
    0
    ive organized your post a bit better for you, you can use it if you want. i just thought it would be easier to read this way. feel free to rephrase some things if you choose to use it.

    thanks a lot for your additions, they seem great. i cant test at the moment, as i am without an xbox.
     
    #41 xWooden leafx, Oct 23, 2010
    Last edited: Oct 24, 2010
  2. ao6Adam

    ao6Adam Forerunner

    Messages:
    22
    Likes Received:
    0
    How can I see the forum code of what you did for me? When I click quote It just comes up with what you wrote outside of the quote.
     
  3. LIGHTSOUT225

    Senior Member

    Messages:
    5,576
    Likes Received:
    5
    Great work, sir. I'm going to stick this thread for the time being
     
  4. xWooden leafx

    xWooden leafx Ancient
    Senior Member

    Messages:
    1,316
    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 my 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 FORMULA, MAP REFLECTION FORUMULA, AND ROTATION AROUND A POINT FORMULA
    [/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.

    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 rotation relative to the line and the exact same distance away.
    lol i forgot about that. just copy and paste everything in the spoiler if you want to use it.
     
  5. Rifte

    Rifte Ancient
    Senior Member

    Messages:
    2,610
    Likes Received:
    36
    Thank you so much for this, I've been trying to build a new map with a lot of curved symmetrical parts and can't get the angles correctly. Wish I had seen this thread earlier :(

    Fantastic job.
     
  6. ImI METAL ImI

    ImI METAL ImI Ancient
    Senior Member

    Messages:
    593
    Likes Received:
    66

    Yes, I saw what you posted. But you need the mathematica software in order to use it so that's why I suggested a flash calculator. Chillax.
     
  7. Organite

    Organite Journalist
    Senior Member

    Messages:
    1,742
    Likes Received:
    5
    I've been trying to come up with angles and calculations to do these kind of things and all of my formulae ended in rage face.

    Then again I'm not very fully experienced in trigonometry yet.
    Nonetheless you saved me a bunch of work.
    Thank you =]
     
  8. Xcrasy sevX

    Xcrasy sevX Forerunner

    Messages:
    14
    Likes Received:
    0
    Umm you could fry your brain figruing that out...or you could just nudje it around till its right...
     
  9. Hippie Gamer

    Hippie Gamer Forerunner

    Messages:
    64
    Likes Received:
    0
    Congrats on this being stickied.
    i Still get a laugh at the first (and now the post above me) post
     
  10. xWooden leafx

    xWooden leafx Ancient
    Senior Member

    Messages:
    1,316
    Likes Received:
    0
    or you could use the excel sheet, and have it at the exact angle you want. pretty dang easy too.
    what we really needed bungie to do is for when you rotate it horizontally, the vertical rotation changes. and than the roll goes off of that. not a mosh pit bewtween all of them.
     
  11. Cheerful Dub

    Cheerful Dub Ancient
    Senior Member

    Messages:
    16
    Likes Received:
    0
    Awesome, thank you so much!
     
  12. Random11714

    Random11714 Ancient
    Senior Member

    Messages:
    81
    Likes Received:
    0

    Ah, I've never known of the sign function. I wonder when I will learn of it.
     
  13. Cosmic Rick

    Cosmic Rick Ancient
    Senior Member

    Messages:
    1,163
    Likes Received:
    1
    Why didn't I see this BEFORE I made that geodesic bowl thing for Hedgehog slayer!

    Thanks for doing the mental heavy lifting here. Quick reference charts, FTW!

    Next time you see some sweet rotational symmetry in one of my maps, you'll know that you had a hand in it.
     
  14. Acd0

    Acd0 Forerunner

    Messages:
    14
    Likes Received:
    0
    This was pretty helpful. I'll be sure to put this to the test the next time a block starts to anger me.
     
  15. i eat clowns

    i eat clowns Forerunner

    Messages:
    19
    Likes Received:
    0
    this is helpful thx
     
  16. ao6Adam

    ao6Adam Forerunner

    Messages:
    22
    Likes Received:
    0
    Yea don't worry, I thought I knew a lot about rotation until I started to calculate those formulae. There was a lot of raging on my end for at least 2 days lol. I ended up teaching myself a whole new area of mathematics lol.


    Yea I know what you mean.

    Thanks to everyone else for feedback and help :)

    [br][/br]
    Edited by merge:


    Its possible you never will need to but university seems the most likely place to learn of it.
     
    #56 ao6Adam, Oct 29, 2010
    Last edited: Oct 29, 2010
  17. EpicFishFingers

    EpicFishFingers Ancient
    Senior Member

    Messages:
    2,887
    Likes Received:
    6
    Some other notes:

    - Sometimes forge will almost 'understand what you're trying to do (especially evident with building blocks) and change the co-ordinates you've inputted to different ones. This is also the case if you use default turning, then edit co-ordinates
    - I don't know if it's part of this, but sometimes an object's pitch and yaw will literally be the same thing. this seems to happen if you rotate the pitch to an increment of 90 degrees, then turn the roll, then yaw. When you turn the pitch again,it'll alernate between controlling yaw and roll and yaw (or something like that;it alternates between controlling one and two of the variables)
    And to the people that dislike the maths: you don't have to reply. If you're more of a designer, or you don't understand the maths (for the moment, I don't get it either. I've only skimmed over it, and haven't attempted to derive it yet), just fudge it. Take a piece, turn it without using edit co-ordinates, then only use edit co-ordinates to edit the height (z axis - obviously an engineer rather than a designer made this tool, as traditionally, outside engineering, the y axis is the 'up' axis, and the z axis is the '3d' axis). If you're a true designer, you'll be doing it 'by eye' anyway, and will seldom use the co-ordinates.

    I'll take a look at the spreadsheet though :) hopefully I'll be able to give you some more-sided circles too, if I can figure out your maths. Glad this got stickied, too
     
  18. Scalpel Technique

    Senior Member

    Messages:
    132
    Likes Received:
    5
    Hey adam

    I could really use this for a map but maths is my weak point so a few questions: what level of maths would you need to be able to use this, do you need to understand triginometry at all? because I've never been able to understand it


    What are tips you could give to someone ignorant in maths in getting started with this system.

    Are you able to just convert what angle you want into numbers using a straight forward process, or do you have to use the formulas, because if that is the case I think I'll give it a miss.
     
  19. ao6Adam

    ao6Adam Forerunner

    Messages:
    22
    Likes Received:
    0
    You don't need to be able to understand any maths because of the spreadsheet I made. All you need is an understanding of the angle you want.

    Just imagine that when you place a block in forge world 0 degrees is the side facing out to sea. That would be to the left based on the default spawn. If you think of it like a flat clock then 12 would be out to sea. And the default spawn would be facing 3 o'clock.

    Now if you wanted a block to face 3 o'clock the first angle you enter on the spreadsheet would be 90 degrees. 6 o'clock would be 180 degrees and so on. Now you need to know the steepness of the ramp so 0 degrees would be flat and 90 degrees would be vertical. A nice angle might be 30 degrees which is the example I used. This would mean that a ramp would go up at 30 degrees from the ground and uphill would be towards 3 o'clock.

    If you just put those numbers in to the spreadsheet it will give you the correct pitch, yaw, roll to enter in forge coordinate editing. This example would give you 0, 90, 30.

    So long as you can specify the angle you would like you won't need any ability to use / manipulate formulae.

    [br][/br]
    Edited by merge:


    Forge doesn't try to understand what you're trying to do, when you click coordinate edit it simply rounds all coordinates to the nearest tenth and angles to the nearest whole number. I personally think Bungie should increase the accuracy of coordinate editing maybe to the nearest hundredth.

    What you've said about the numbers being the same is correct. When you're in line with a particular plane (I can't remember which) there is more than 1 way to describe a particular rotation hence the number being the same and why they sometimes change when you open coordinate editing, yet the object doesn't move.

    Whenever you deal in 3 dimensions the vertical axis is almost always z because x and y have been used. Imagine you had a piece of paper with a graph showing x across and y up. Place that piece of paper on the table so that x is left and right and y is forward and back. To move to 3 dimensions imagine an axis coming straight out of the paper. That is then labelled the z axis. In any 3D design tool the vertical axis will almost always be z, it is simply the convention used. So in this case Bungie is most certainly correct.

    As for doing it by eye it is undeniably needed, especially for lining things up. When it comes to angles however any kind of construction almost always requires accuracy, I wouldn't want a door in my house that didn't fit the frame because the person cutting it insisted on doing it 'by eye'.

    In terms of forging, making ramps fit together properly when you aren't lined up with the x or y axis is hugely problematic (I have yet to see it be done properly) or making a banked race track the pieces can be next to impossible to angle correctly especially by eye.

    This is where this sheet really tries to fill in. Just as how you might want to coordinate edit to get to objects to join perfectly. It's such a shame that Bungie's rotation scheme uses such an unorthodox method of rotating.

    But if you don't understand maths, don't be put off by the formulae, just open up the spreadsheet and it works it all out for you.
     
    #59 ao6Adam, Oct 31, 2010
    Last edited: Oct 31, 2010
  20. Bluegobln

    Bluegobln Forerunner

    Messages:
    20
    Likes Received:
    0
    This is truly amazing. I've been struggling with objects every now and then and this may have just solved it for me completely! THANKS! :D
     

Share This Page