User Tag List

Page 3 of 6 FirstFirst 1 2 3 4 5 ... LastLast
Results 21 to 30 of 51

Thread: Rotating platforms

  1. #21
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Re: Rotating platforms

    I finished the example! It works quite nicely, too. If you break up the expressions I used, you can see how the trigonometry works into it. It was actually a lot simpler than I had thought...

    http://mfa.aquadasoft.com/view/1293428269-Velocity
    Working as fast as I can on Fusion 3

  2. #22
    No Products Registered

    Join Date
    Aug 2010
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Rotating platforms

    Ahh, excellent! I'm beginning to understand this now. Just a question, though: Does an object similar to the green slider need to be there to control movement? I doubt it, but it's just an inquiry I had.

  3. #23
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Re: Rotating platforms

    No, I just put that there so you could change the size of the imaginary rotating platform. Really all you need for the radius is the distance between the center of the rotating platform and the contact point between the player and platform.
    Working as fast as I can on Fusion 3

  4. #24
    No Products Registered

    Join Date
    Aug 2010
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Rotating platforms

    Cool beans! Woo, managed to get it working by deleting all of the slider bits and adding platform movement to it. Of course, since the default platform movement's collision detection stinks to high heaven, I'll have to build a fastloop engine now, but it works like a charm! Thank you so much for all your help, LB!

  5. #25
    No Products Registered

    Join Date
    Aug 2010
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Rotating platforms

    OOAGA

    Sorry for the jibberish, but man is this ever frustrating. I know that there's a solution in reach, I can feel it, but I'm still having the same problems with the character getting stuck in the platform when the rotating object makes its way up. I know the radius and X and Y velocity play into this somehow, but HOW is my question.

    I feel like I've had this explained to me already in the thread, and maybe the concepts just flew over my head, but I really, really just want to get this working out properly.

  6. #26
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,537
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Rotating platforms

    I did it for my Asunder demo, if you saw it on TDC.

    Rotating platforms are probably the hardest single feature to implement I found out. They are insanely hard to get down, and even now that I've got them working with multiple layers of redundancy and error checking, they still malfunction a bit (if you slow down time, they'll shunt you far too quickly as they rotate).


    Basically, you want to move your player by converting him to a polar coordinate, rotating that coordinate, and converting it to cartesian. Or in other pseudo:

    T = Angle from player to platform = atan2(y1-y2,x2-x1)
    S = Distance from player to platform = sqr((x2 - x1)^2 + (y2 - y1)^2)
    Q = Rotated angle since last frame
    New X = cos(T + Q) * S
    New Y = -sin(T + Q) * S


    this, unfortunately, does not work. Because if your platforming is pixel perfect and cares if your player is located inside of the object- there is a discrepancy between where you calculate your rotated point and where the image pixels are. You might be off by +/- 1 pixel in both the X and Y. You might have the new location that was previously outside of the platform be just inside of it- an error which quickly compounds with each step. Your player will either get quickly "sucked into" the center of the platform, or "blown outwards" the opposite way.

    Imagine you had a 3x3 image. An array with X = 1, 2, 3, and Y = 1, 2, 3. So 9 pixels total in a 3x3 square, center at (2,2). Now, if you rotated it 45 degrees, you'd have a diamond of some shape- probably inscribed in a 5x5 square. But now lets say you only rotated it 20 degrees- what shape would it be? It would still be a 3x3 square, since there was not enough change to effect it. But your rotation algorithm, due to rounding errors or even if its giving the exact right coordinate, might put the player who was standing at (4,2) into location (3,1)- from standing on the outside right middle surface into the top right corner inside of the square. He went from not overlapping the object to overlapping it. On the next round, he might get sucked into (2,1), then (2,2). Now hes in the center of the platform and permanently stuck there, forever rotating in a platformy prison.

    The reality is, theres just no good way to do it. I did it by having it set up to suck in the player slightly, then doing a redundant layer of detection if the player is now inside of the platform, casting him slightly outside of it- if that doesn't work within a reasonable amount of loops, it just pushes him outwards at a random X/Y location getting larger and larger until it finally expels him. Its a very crude, inelegant way to do it, but at least it worked.


    So yeah, as far as platforms go, this is the absolute hardest thing you can possibly try to do.

  7. #27
    No Products Registered

    Join Date
    Aug 2010
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Rotating platforms

    Oh my. didn't realize that. I've seen so many engines using it, without putting much thought into how hard it actually is. I'm sure there are ways to do it outside of MMF2, but it's probably pretty complex all the same.

    Just one question, though: What does "Rotated angle since last frame" mean exactly?

  8. #28
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,537
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Rotating platforms

    rotated angle since last frame would be how many degrees it rotates per frame. If you had a game running at 50 FPS and had it rotating 200 degrees per second, it would rotate 4 degrees per frame. But if it was rotating 75 degrees per second at 50 FPS, it would be alternating between 2 & 1 degree per frame- you'd need some method to record the difference in angles (record the previous angle and compare it to the new angle each frame)

    It is much easier in a vector based game or otherwise surface based instead of collision array game. MMF2 runs on a 2d collision map, whereas a 3d game might simply record abstract surfaces in terms of their end points and calculate collision by iterating through nearby surfaces and testing- this allows them to be arbitrarily "correct" and do rotation effects much easier, but makes minute details extremely resource heavy.

  9. #29
    No Products Registered

    Join Date
    Aug 2010
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Rotating platforms

    Thanks for the information about degrees per frame, Pixel.

    It's really disappointing to hear that it simply isn't possible to to this sort of thing correctly, as I was really looking forward to the possibility of it. I think I'll be able to get past having to do that sort of thing in the game I'm making, but it's a disappointment nonetheless.

    But one thing has me confused. Some Japanese MMF2 user managed to implement a circular clockwork-like rotating platform perfectly in this video. I know it's not the same thing as a rectangular spinning platform, but it still perplexes me.

  10. #30
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,537
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Rotating platforms

    That castlevania method seems to involve something with the cog spokes actually pushing the player instead of direct repositioning but I could be wrong. Its not impossible at any rate, its just difficult- my engine can handle virtually any shaped object rotating, but I don't think I'd ever want to have to try writing those platforms again.

    I'm sure theres shortcut tricks you could do if your platforms are all a preset size- ie moving the player along a preset circular radius at an exact distance from the center when hes moved, instead of calculating the distance.

    For example, figure out the radius your player would be at from the center of the object. Maybe 80 pixels for a 75 radius circle or something. Then push the player only when he is in his 'standing' mode, when he is not airborne- and calculate the angle to him and increment it in whichever direction with the polar coordinates, but don't bother calculating the distances- just set it to

    X = cos(angle + difference) * 80
    Y = -sin(angle + difference) * 80


    that way the player would never get sucked in or pushed out from the center of the object, since it would always be at the exact same distance

Page 3 of 6 FirstFirst 1 2 3 4 5 ... LastLast

Similar Threads

  1. Rotating Moving Platforms
    By Viewtiful in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 24th December 2010, 10:48 AM
  2. MMF to other platforms ..............
    By Digitalmayhem in forum Multimedia Fusion 2 - Technical Support
    Replies: 19
    Last Post: 18th June 2009, 11:39 PM
  3. Rotating Gun Example
    By Jaffob in forum File Archive
    Replies: 6
    Last Post: 26th May 2009, 12:58 AM
  4. help with platforms please.
    By burai in forum The Games Factory 2 - Technical Support
    Replies: 2
    Last Post: 28th March 2009, 06:15 PM
  5. Duplicated Rotating Platforms
    By Cossin in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 20th November 2008, 04:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •