Adding entities to hkpConstraintChainInstance on the fly?

Adding entities to hkpConstraintChainInstance on the fly?

mxms's picture

Hi All,

I was wondering: if I have a hkpConstraintChainInstance that I setup initially, and would later want to make the chain longer by adding more links, would it be possible? In particular, would a call such as

chainInstance->addEntity( body ); // Adding a new link at one end

on a keypress event (say) be supported? I feel hkpConstraintChainInstance may not allow such dynamic changes.

If not possible, would creating entities and constraints between them manually to form the chain (and adding on more entities manually too) without using hkpConstraintChainInstance be the only way out?



2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
sean.thurston's picture

Hi Varun,

I would say that this is one of those play around with it and see if get an assert, crash, or just see how it looks situations.

That being said, you cannot add a body to the constraint chain after it has been added to the world. You could try removing it from the world, adding the body, and then adding it back into the world. I haven't tried, so i don't know what the results will be.

We have talked about the limits of hkpConstraintChains versus a chain of constraints in (just for anybody else following along).

Let me know how it goes.


Developer Support Engineer Havok

Login to leave a comment.