Results 1 to 8 of 8

Thread: Is there a way to randomize the bouncing ball physics movement?

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module

    Join Date
    Jul 2006
    Location
    Tallmadge, Ohio USA
    Posts
    257

    Is there a way to randomize the bouncing ball physics movement?

    In the normal bouncing ball movement properties there exists a randomizer and security values to keep the balls from "getting stuck" in redundant positions. Can this be achieved in the physics bouncing ball movement? I'm working on a small game that uses this movement but the balls very easily get stuck bouncing in the same place.
    Thanks.

  2. #2
    I got the same issue, can someone help?

  3. #3
    I'm not sure if there's a cleaner method as I don't use it very much,
    but perhaps you can add some very little random amount to one or more of the object's physics parameters (angular velocity, torque..) upon bouncing,
    this would theorically ensure you don't end up looping in redundant situations..?
    a selection of my Fusion examples can be found here

  4. #4
    Quote Originally Posted by schrodinger View Post
    I'm not sure if there's a cleaner method as I don't use it very much,
    but perhaps you can add some very little random amount to one or more of the object's physics parameters (angular velocity, torque..) upon bouncing,
    this would theorically ensure you don't end up looping in redundant situations..?
    I would have to constantly do that as the balls tends to always get stuck in bouncing in the same place

  5. #5
    Is it possible to do something like this: whenever the ball bounces, set it to a random direction? Or whenever it bounces, add 1 to one of its alt values and make a timer. Every 20 milliseconds or whatever +alt value >0 ----> subtract 1 from alt value. If alt value = 5 or whatever you want just set a random direction to the ball. Of course this would only work if it gets stuck and bounces in a small area because of the timer.

    An alternative could be that if the ball bounces and an invisible object is not colliding/overlapping the ball...create that invisible object at the balls position and everytime the ball hits that object increase the alt value and then make a random direction after a few hits and destroy the invisible object? I don't know just doing some quick thinking after lack of sleep

  6. #6
    @gentique:
    you can do it constantly or not, depending on your application of course,
    I think doing it upon bounce is less noticeable for the player
    (changing direction while moving should be done subtly to avoid abrupt direction change mid-air)
    here's a quick example of what I meant:

    random_physics_bball.mfa

    blue ball is slightly randomized, purple is not
    blue trail might be caught in some recognizable pattern for a cycle or two but should escape it after a few iterations
    while purple one can run into long (endless?) loops

    you can tweak it to your needs,
    the more subltly you randomize bounces, the more natural bouncing will feel, but higher the risk of redundancy



    ___ edit:

    elaborating on Klownzilla's ideas,
    you could also think of saving bounce positions in a string on every bounce, like this:
    X10Y20|X576Y24|X33Y87|...
    when you detect the same pattern being iterated multiple times:
    X10Y20|X576Y24|X33Y87|X10Y20|X576Y24|X33Y87|...
    you can apply an impulse to unlock the situation
    this would require a bit more code though
    Last edited by schrodinger; 13th September 2017 at 01:32 PM.
    a selection of my Fusion examples can be found here

  7. #7
    @schrodinger I tried your mfa out and it works good while there is gravity on the objects, but for my purpose there is 0 gravity, and it seems that your randomized ball get's stuck while it's in a horizontal path(which is also my issue as the physics bouncing ball favors to go on a horizontal path). Also while bouncing on a vertical line it tends to go to the right side (just throwing this out).

  8. #8
    You can try adding some other impulse/force/other then,
    I've added a bit of torque here and increased forces intensity,
    with a bit of tweaking you can likely get it the way you want:

    random_physics_bball_nograv.mfa
    a selection of my Fusion examples can be found here

Similar Threads

  1. Physics - Bouncing Ball Movement seems to be missing
    By valkill100 in forum Fusion 2.5
    Replies: 8
    Last Post: 10th August 2014, 07:46 PM
  2. Possible bug with Bouncing Ball physics
    By Angry_Dwarf in forum Android Export Module 2.5
    Replies: 2
    Last Post: 4th March 2014, 09:45 PM
  3. 2.5 physics bouncing ball + platform movement hybrid
    By RedHades in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 30th December 2013, 05:11 PM
  4. Deceleration on bouncing ball (physics)
    By danjo in forum Fusion 2.5
    Replies: 8
    Last Post: 18th October 2013, 05:41 AM
  5. Physics, Bouncing Ball
    By KLiK-iT in forum Fusion 2.5
    Replies: 10
    Last Post: 8th October 2013, 11:47 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
  •