Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Bouncy Ropes?
#1
Guiño 
Hi,

me again. After my previous two posts which were related to making a wobbly weiner (for anyone with a similar endeavour here are the links: http://obi.virtualmethodstudio.com/forum...-3690.htmlhttp://obi.virtualmethodstudio.com/forum...-3693.html) I now want my weiner to also be bouncy. 

Sounds weird I know but the behaviour I want to achieve is to have it bounce of a floor it is hitting .... 

Well. The only Idea I had was to change the stickiness of my collision material to a negative value (I tried -1) and set the stick distance to something arger than 0 (I tried 0.1). That way (according to the drawing in the article here http://obi.virtualmethodstudio.com/manua...rials.html) a bouncy behaviour should occur - in my mind.

You guessed it right, it does not. Am I doing something wrong or is that behaviour not achievable with Obi Rope?

Best, 

Robert
Reply
#2
(14-12-2022, 06:56 PM)roberthey Wrote: Hi,

me again. After my previous two posts which were related to making a wobbly weiner (for anyone with a similar endeavour here are the links: http://obi.virtualmethodstudio.com/forum...-3690.htmlhttp://obi.virtualmethodstudio.com/forum...-3693.html) I now want my weiner to also be bouncy. 

Sounds weird I know but the behaviour I want to achieve is to have it bounce of a floor it is hitting .... 

Well. The only Idea I had was to change the stickiness of my collision material to a negative value (I tried -1) and set the stick distance to something arger than 0 (I tried 0.1). That way (according to the drawing in the article here http://obi.virtualmethodstudio.com/manua...rials.html) a bouncy behaviour should occur - in my mind.

You guessed it right, it does not. Am I doing something wrong or is that behaviour not achievable with Obi Rope?

Best, 

Robert

Hi!

Not achievable in Obi, at least not out of the box. This technical term for this is called "restitution" or "elastic collision response". Collisions in Obi are perfectly inelastic because cloth, ropes and fluid have zero restitution in the real world (they're not bouncy at all), and softbodies have their own restitution built-in since they're soft and tend to bounce automatically.

You can't approximate this using negative sticking. One -slightly complex- way of implementing it would be to subscribe to contact callbacks, and then modify the velocity of particles involved in a contact, increasing it by some amount in the direction of the contact normal. See:
http://obi.virtualmethodstudio.com/manua...sions.html

I will look into adding built-in support for restitution in the future, should be doable.

kind regards,
Reply
#3
Hi Jose,

thanks for your interesting answer and explanation. For everyone that wants to do this for now, I figured out somewhat of a solution:

I dynamically attach two rigidbodies to the ends of the weiner which don't collide with the weiner itself and then I make those bounce. Result is satisfactory. 

Regarding what you said about applying force to the particles: I had a look at the article - very helpful, thanks. Is the only way I can apply force to modify the velocity of the particles or is there a AddForce like method to do it aswell?

Best,

Robert
Reply
#4
(15-12-2022, 11:27 AM)roberthey Wrote: Regarding what you said about applying force to the particles: I had a look at the article - very helpful, thanks. Is the only way I can apply force to modify the velocity of the particles or is there a AddForce like method to do it aswell?

Hi!

There's an externalForces array in the solver that you can write forces into, similar to how you would for all other particle data arrays (velocities, positions, etc). However, all data in this array gets reset to zero at the end of each simulation step (in order to stop applying forces on subsequent frames) which means writing to it during the contact callback doesn't have any effect, as forces aren't carried over to the next frame.

So if you're applying forces during the contact callback, the best way is to modify the velocities itself. Note that F = ma, so a = F/m. Keeping this in mind you can convert a force to an acceleration (that is, a change in velocity) very easily:

Code:
solver.velocities[particleIndex] += yourForce * solver.invMasses[particleIndex] * deltaTime;
Reply
#5
Damn. You thought of everything.

Thanks a lot Jose Sonrisa
Reply