User Tag List

Results 1 to 5 of 5

Thread: Box2D - When item explodes, affect body/shape near

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Tuna's Avatar
    Join Date
    Feb 2008
    Location
    Central Texas
    Posts
    1,853
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Box2D - When item explodes, affect body/shape near

    I've learned quite a bit working on this new project of mine... but one thing still eludes me:

    When an item explodes near other body/shapes, I'd like the effect of the explosion to move (even if slightly) the other bodies/shapes.

    I tried using Body>Modify>Velocity>Apply Force (and Apply Velocity) but the results were counter-intuitive.

    For example, the explosion moved a body on the left side of the bomb to the RIGHT! I expected it to move to the left, since it's on the left of the bomb.

    Any ideas?

  2. #2
    No Products Registered

    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    1,141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Box2D - When item explodes, affect body/shape near

    There is an explosion demo in the testbed.

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Tuna's Avatar
    Join Date
    Feb 2008
    Location
    Central Texas
    Posts
    1,853
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Re: Box2D - When item explodes, affect body/shape near

    Yeah, I toyed around with that and couldn't see any effects from the changes I made.

  4. #4
    No Products Registered

    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    1,141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Box2D - When item explodes, affect body/shape near

    Looking back at this demo I really should have made it value-controlled. It was originally a quick test I did for a friend that ended up in the testbed. Anyways, here's a little info how you can modify the explosions properties:

    To modify the explosion radius, change the value 64 for the raycast action in event 41 and the value 65 (64+1) in the set ray distance action in event 42.
    RayDistance is actually the strength, a bit bad naming there.
    For the drawing you may also change event 43 in the same manner, but that won't affect the explosion physics.

    To change the strength of the explosion, change the value 25 at the end of the Set Ray Distance formula. Note that the strength is also dependent of the explosion radius.

    You can if you want make the explosion more precise by increasing the number of rays, but that shouldn't be needed.
    If you do want to test it out, change how many loops are started (originally 36) and the number of degrees the raycast and apply force actions are rotated each step (originally 10).
    Note that the number of rays hitting an object directly affects the force applied to said object.

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Tuna's Avatar
    Join Date
    Feb 2008
    Location
    Central Texas
    Posts
    1,853
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Re: Box2D - When item explodes, affect body/shape near

    Thanks Werbad, I didn't really understand RayCast... actually, I still don't, but I'll spend some time with it. I learn by experimenting.

    Thanks again!

Similar Threads

  1. Box2D Shape test
    By Outcast in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 5th May 2013, 09:38 AM
  2. Box2D or Chipmunk physics, how do I shrink or grow a shape?
    By RedHades in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 1st February 2012, 03:36 AM
  3. Help with item after it gets hit/explodes
    By cds12345 in forum Multimedia Fusion 2 - Technical Support
    Replies: 9
    Last Post: 24th November 2011, 03:58 PM
  4. BOX2D - Shape Test / BodyID to an array then loop
    By Tuna in forum Hardware Accelerated Runtime
    Replies: 9
    Last Post: 12th April 2010, 10:26 PM
  5. [Suggestion] Extra shape for Window Shape object
    By LIJI in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 5th March 2007, 06:32 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
  •