User Tag List

Results 1 to 7 of 7

Thread: Vector Movement - How to detect angle of wall?

  1. #1
    Clicker Fusion 2.5 DeveloperSWF Export Module
    Strife's Avatar
    Join Date
    Sep 2006
    Location
    Upstate NY
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Vector Movement - How to detect angle of wall?

    I'm trying to a build a racing game in MMF2, in which the player's kart moves using the built the built-in Vector movement. This movement has an action called "Force bounce," but it requires that you input the angle of the surface it collides with. Because of this, it would seem that I'd have to make all of my walls active objects, which would be really taxing on resources.

    Is there a way to determine the angle of a backdrop wall when the kart collides with it? (i.e. using detectors and such.) At the moment, I'm having the kart switch to the Bouncing Ball movement whenever it approaches a wall, but that's not my ideal solution since it only has 32 directions and makes for some wildly inaccurate bouncing.

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

    Re: Vector Movement - How to detect angle of wall?

    You could run a loop to look around the object and use the Frame Object's "Test for Obstacle at X, Y"
    Working as fast as I can on Fusion 3

  3. #3
    Clicker Fusion 2.5 DeveloperSWF Export Module
    Strife's Avatar
    Join Date
    Sep 2006
    Location
    Upstate NY
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Vector Movement - How to detect angle of wall?

    I figured it would involve something like that. In order to achieve this, would I run the loop 360 times around the object and have it take note of when it overlaps a backdrop? If so, what kind of equation would I use to figure out the angle of the surface?

    Here's an example diagram of what I'm aiming at:



    The triangle is a backdrop object, and the circles are karts. Both karts are on a collision course with a surface that's tilted about 30 degrees. No matter what angle the kart approaches the backdrop at, they would need to determine that the surface they're about to hit is 30 degrees.

    What might make this tricky is that the Force Bounce action asks you to input an angle that's relative to the frame, not the object itself.

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

    Re: Vector Movement - How to detect angle of wall?

    Well, once you find the overlap, you're pointing at the surface. Once you have that you can add 90 to find the angle and/or add 180 to find the normal angle.

    "relative to the frame, not the object itself."

    There's a difference?
    Working as fast as I can on Fusion 3

  5. #5
    Clicker Fusion 2.5 DeveloperSWF Export Module
    Strife's Avatar
    Join Date
    Sep 2006
    Location
    Upstate NY
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Vector Movement - How to detect angle of wall?

    Okie dokie. I tried experimenting with the concept like so:



    The black arrow represents the direction that the kart was travelling in before the collision. The blue crosshairs are the coordinates that are being tested, and during the loop, I have them "rotate" around the kart until the coordinates of both crosshairs overlap an obstacle. Once they do, I grab the angle.

    It's a start... but unfortunately, it doesn't take into account how much the kart has sinked into the wall. In order for this to remain secure and accurate, I would need to figure out a way to instantly push the kart back out of the wall before I perform the loop. I could just reverse its direction while reducing speed, but that's not instantaneous.

  6. #6
    Clicker Fusion 2.5 DeveloperSWF Export Module
    Strife's Avatar
    Join Date
    Sep 2006
    Location
    Upstate NY
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Vector Movement - How to detect angle of wall?

    Holy wow, I finally got it working after scratching my head all day. :'D It's a rather creative concept too, so I decided to upload the solution and share it with anyone else who might have a similar problem in the future:

    http://games.galaxytrail.com/vector_angledetector.zip

  7. #7
    Forum Moderator

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    nivram's Avatar
    Join Date
    Jul 2006
    Location
    Bandon, Oregon
    Posts
    6,773
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)

    Re: Vector Movement - How to detect angle of wall?

    Thanks for that Strife.

    Marv
    ​458 TGF to CTF 2.5+ Examples and games
    http://www.castles-of-britain.com/mmf2examples.htm

Similar Threads

  1. Vector angle math
    By tompa in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 2nd December 2013, 07:31 AM
  2. Vector bullet fired from 360...how to set angle to face direction?
    By Blacstar in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 8th March 2012, 05:01 PM
  3. Setting angle for a vector movement
    By Brandon in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 8th April 2007, 11:00 PM
  4. how to add to angle of vector movement
    By Deano in forum The Games Factory 2 - Technical Support
    Replies: 3
    Last Post: 31st January 2007, 02:23 AM

Posting Permissions

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