Loading...
You are not logged-in Login/Register





  • Posts   Search Threads
  • mxmsOctober 10, 2008 2:37 PM PDT   
    Breakable Chain - best way to implement this requirement

    Hi,

    I've been playing around with Havok (5.5) since it was released this summer and have decided to integrated with a unique game we're working on.

    Its basically a kite flying game, but not one with stunt kites and tricks. Its a networked multiplayer kite combat game. We're using Ogre 3D, Raknet, and have integrated the WiiMote for more realistic interaction with the kite rope. We already have a demo of this without the use of physics at all, but it doesn't look as good.

    Here's what we're looking for:

    Picture+004.jpg

     

    [A]
    Whats done so far:
    Rendering a kite string. I've been able to do this using the hkpConstraintChainInstance like in the Ball and Socket Rope demo. I am querying the position of the last sphere in the chain and setting it as the position of a kite model every frame.

    What we need to do:
    The user's input directly affects the movement of the kite. I'd like to be able to give any arbitrary position to the kite model, and have the chain instance end at that position. I believe objects set as Keyframed are able to behave like this. What is the best way to achieve that behaviour for the rope?

     

    [B]
    In the game, we have a maximum of two players fly their kites with each other. We need to be able to:
    - Have collision between the kite strings.
    - Keep a track of which links in the rope are colliding so what the associated link health can be reduced.


    [C]
    From [B] above, when a particular link's health depeletes completely (could belong to either kite), we need that link to break. The effect would be similar to whats shown in the image. Again, I would like to know the best way to implement this.

     

    The only thing I've acheived so far is to take the rope similar to the Ball and Socket Rope demo, and attach a kite mesh to one end. I just wanted to be pointed to the right direction for the rest of the features in [A], [B] and [C] in terms of what type of constraints I should use, if there are other classes similar to hkpConstraintChain that could be useful, etc. If you could let me know which of the Havok demos I should look at, nothing like it.

    Thanks for your time,
    Varun.



    mxmsOctober 10, 2008 2:50 PM PDT
    Rate
     
    Re: Breakable Chain - best way to implement this requirement

    By the way, here's a video of the 'old version' that uses no physics for the rope but bezier curves (and loads of math) instead. This iswhat we're looking at replacing with a Physics-based kite string.

    An instance of collision / combat is towards the end of the video.

    Varun.



    sean.thurstonOctober 13, 2008 6:06 PM PDT
    Rate
     
    Re: Breakable Chain - best way to implement this requirement

    Hi mxms,

    Cool video, I like the weird kind of art-style you have going there with the sun.

    Unforturnately, this is kind of a bad case scenarios for constraints. You have long, thin chains that are using ball and socket constraints which limit translation, but not rotation. Then you are going to tangle a few of them up.  I could see this becoming unstable pretty quick due to angular forces.

    If you want to be able to break the constraints, then you can't really use a constraint chain. You need to use a chain of constraints. Here is some advice on this:

    1) Try to limit the number of constraints you using. Try to use a lower level of detail in the physics rope and interpolate positions in the higher quality graphics rope. Less is always better. I imagine you will probably use capsules for the rigid bodies.

    2) Read the section about stabilizing constraints in the docs. Havok Physics->Havok Dynamics->Constraints->Tuning and Tweaking Constraints.

    3) In order to control the chain, put a rigid body that represents your kite at the end. Attach the chain to the "kite" and then keyframe it. Moving the kite will make the chain move with it.

    4) The constraints are going to be between rigid bodies, so you should be able to do damage in a similar way to how other games do damage. Just do collision detection between the rigid bodies. Make sure to filter out collisions between rigid bodies in the same rope.

    5) Use MOTION_STABILIZED_BOX_INERTIA or MOTION_STABILIZED_SPHERE_INERTIA for the rigid bodies in the rope.

    6) For breaking the link, it might be best to just remove the contraint. This doesn't really work with a hkpConstraintChainInstance.

    Hopefully this will at least get you started. This is probably going to be pretty difficult to work out.

    Let me know how it goes.

    Thanks,
    Sean




    Developer Support Engineer
    Havok
    www.havok.com

    mxmsOctober 14, 2008 1:03 PM PDT
    Rate
     
    Re: Breakable Chain - best way to implement this requirement

    Quoting - sean.thurston

    Hi mxms,

    Cool video, I like the weird kind of art-style you have going there with the sun.

    Unforturnately, this is kind of a bad case scenarios for constraints. You have long, thin chains that are using ball and socket constraints which limit translation, but not rotation. Then you are going to tangle a few of them up. I could see this becoming unstable pretty quick due to angular forces.

    If you want to be able to break the constraints, then you can't really use a constraint chain. You need to use a chain of constraints. Here is some advice on this:

    1) Try to limit the number of constraints you using. Try to use a lower level of detail in the physics rope and interpolate positions in the higher quality graphics rope. Less is always better. I imagine you will probably use capsules for the rigid bodies.

    2) Read the section about stabilizing constraints in the docs. Havok Physics->Havok Dynamics->Constraints->Tuning and Tweaking Constraints.

    3) In order to control the chain, put a rigid body that represents your kite at the end. Attach the chain to the "kite" and then keyframe it. Moving the kite will make the chain move with it.

    4) The constraints are going to be between rigid bodies, so you should be able to do damage in a similar way to how other games do damage. Just do collision detection between the rigid bodies. Make sure to filter out collisions between rigid bodies in the same rope.

    5) Use MOTION_STABILIZED_BOX_INERTIA or MOTION_STABILIZED_SPHERE_INERTIA for the rigid bodies in the rope.

    6) For breaking the link, it might be best to just remove the contraint. This doesn't really work with a hkpConstraintChainInstance.

    Hopefully this will at least get you started. This is probably going to be pretty difficult to work out.

    Let me know how it goes.

    Thanks,
    Sean


     

    Hi Sean,

    Thanks a lot for the info - yeah I realize it isn't a trivial problem to solve, but will give it a go and see where we reach. Lower level detail in the physics rope and interpolating for higher detail is a great idea.

    While going through the Swinging Rope demo, it showed how much more efficient the constraint chain approach was, which is why I tried it out. Would the reason for not using constraint chain only be that the constraints are not breakable? Could we still have collision detection between two strings using constraint chain?

    I'll work on a chain of constraints today and see how it comes out. Thank you for your inputs - will let you know about progress.

    Regards,
    Varun.



    sean.thurstonOctober 14, 2008 5:39 PM PDT
    Rate
     
    Re: Breakable Chain - best way to implement this requirement

    Quoting - mxms

     

    Hi Sean,

    Thanks a lot for the info - yeah I realize it isn't a trivial problem to solve, but will give it a go and see where we reach. Lower level detail in the physics rope and interpolating for higher detail is a great idea.

    While going through the Swinging Rope demo, it showed how much more efficient the constraint chain approach was, which is why I tried it out. Would the reason for not using constraint chain only be that the constraints are not breakable? Could we still have collision detection between two strings using constraint chain?

    I'll work on a chain of constraints today and see how it comes out. Thank you for your inputs - will let you know about progress.

    Regards,
    Varun.

    Hi Varun,

    The Swinging Rope demo is a good demo. The constraint chain is much more stable for the kind of thing you are doing, but you can't really remove from it once its been constructed. Its kind of the nature of how the constraints inside the chain are solved. It uses it own kind of solver and then is passed to the physics simulation as a single constraint.

    You should still be able to get collision data out of it because it is still made up of rigid bodies. One thing you could try is when you determine that a break should occur, just construct new chains. I'm sure there are some extra tricks you can try to gain performance, like pre-allocating double the number of rigid bodies so you don't have to construct new rigid bodies. You just need to construct the new constraint chain when it breaks and replace the active chian with the new chain. You can try some things like that if need be.

    Let me know how it goes.

    Thanks,
    Sean



    Developer Support Engineer
    Havok
    www.havok.com

    mxmsOctober 14, 2008 6:09 PM PDT
    Rate
     
    Re: Breakable Chain - best way to implement this requirement

    Quoting - sean.thurston

    Hi Varun,

    The Swinging Rope demo is a good demo. The constraint chain is much more stable for the kind of thing you are doing, but you can't really remove from it once its been constructed. Its kind of the nature of how the constraints inside the chain are solved. It uses it own kind of solver and then is passed to the physics simulation as a single constraint.

    You should still be able to get collision data out of it because it is still made up of rigid bodies. One thing you could try is when you determine that a break should occur, just construct new chains. I'm sure there are some extra tricks you can try to gain performance, like pre-allocating double the number of rigid bodies so you don't have to construct new rigid bodies. You just need to construct the new constraint chain when it breaks and replace the active chian with the new chain. You can try some things like that if need be.

    Let me know how it goes.

    Thanks,
    Sean

    Many thanks Sean.

    This is just the kind of help I needed to be sure I'm heading in the correct direction (or at least be aware of the alternatives). Will try out your suggestions.

    Regards,
    Varun.



Forum jump:  

Intel Software Network Forums Statistics

17,025 users have contributed to 48,321 threads and 172,762 posts to date.

In the past 24 hours, we have 11 new thread(s) 45 new posts(s), and 38 new user(s).

In the past 3 days, the most popular thread for everyone has been Optimalization of sine function\'s taylor expansion The most posts were made to Most likely, the issue is that The post with the most views is Optimalization of sine function\'s taylor expansion

Please welcome our newest member mehakchehal52


For more complete information about compiler optimizations, see our Optimization Notice.