User Tag List

Results 1 to 6 of 6

Thread: Box2D Chain Problem

  1. #1
    Forum Moderator Multimedia Fusion 2 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module
    DizzyDoo's Avatar
    Join Date
    Oct 2006
    Location
    South England
    Posts
    718
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Box2D Chain Problem

    Hello, so I've made a chain by jointing a bunch of bodies together using the Box2D extension. Here is the file:

    http://mfa.aquadasoft.com/view/1272871858-CraneTest2

    If it moves slightly quickly, it quickly bugs out and stretches wildly. This is a familiar problem, I remember it being back in the old Chipmunk Phizix object.

    Anyway to fix this?

    Matt
    Cranktrain - Currently finishing a new game called The Cat Machine!
    @MattLuard on Twitter.

  2. #2
    No Products Registered

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

    Re: Box2D Chain Problem

    There are a couple of things you can do to increase stability of the chain.

    You can use distance joints instead of revolute joints, distance joints are generally more stable for a chain. To use a distane joint properly you have to attach the anchors to the center of the bodies to give the joints a bit of distance to work on. The distance joint also allows you to give it a bit of softness so that it won't freak out completely if it's stretched a little. You might have to update the angle manually on the actives if you do this though.

    You can increase the iteration counts in Box2D's properties. The more position/velocity iterations you have the more stable joints will be. Note that soft distance joints aren't position corrected, so only velocity iterations matter for these.

    If you attach something heavy to a light chain the stretching problem will get worse. This can be solved by giving the chainlinks more mass. This increases the total weight of the chain, but I don't know of any better way of solving the problem other than supporing the chain with a max-distance joint, one of the few features Box2D lacks over Chipmunk.

  3. #3
    Forum Moderator Multimedia Fusion 2 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module
    DizzyDoo's Avatar
    Join Date
    Oct 2006
    Location
    South England
    Posts
    718
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Box2D Chain Problem

    Distance joints are working perfectly. For now, at least, I haven't stuck anything on the end yet, but if I throw the hexagon at it, it never messes up no matter how hard.

    The hard thing now is manually setting the angle. If the hotspot is in the middle, how should I go about it?
    Cranktrain - Currently finishing a new game called The Cat Machine!
    @MattLuard on Twitter.

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleSWF Export ModuleXNA Export Module

    Join Date
    Jun 2007
    Posts
    480
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Box2D Chain Problem

    look here !

    http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=187769&#Post187 769

  5. #5
    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: Box2D Chain Problem

    Johnny that's way over the edge and it messes up more than the original problem.
    Working as fast as I can on Fusion 3

  6. #6
    No Products Registered

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

    Re: Box2D Chain Problem

    Get the angle from the body position to one of the anchor positions of one of the attached joints and use that.

    Johnny's example actually displays one of the problems with attaching a heavy object to a light chain. In the example the chain passes through so easily because the pins are way smaller then they look and actually fits through the gaps in the chain, but even if you resize them the chain will pass through due to the heavy load.

Similar Threads

  1. Box2D problem :/
    By Outcast in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 4th July 2012, 09:34 AM
  2. Box2D problem
    By Outcast in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 27th June 2012, 06:52 PM
  3. problem export swf on box2d
    By matte in forum SWF/Flash Export Module Version 2.0
    Replies: 2
    Last Post: 3rd May 2012, 03:14 PM
  4. Chain Reaction Problem - please help
    By cgbartek in forum File Archive
    Replies: 4
    Last Post: 29th September 2011, 08:59 PM
  5. Problem with Box2D
    By Outcast in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 10th April 2011, 05:05 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
  •