Obi Official Forum

Full Version: Changing values procedurally via code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello devs,

Noob here,

I'm trying to set up some nice egg/yolk physics.

One of the things I'm trying to do is to have the soft body yolk inflate from the cracked egg like a balloon.

The way I've found that would work is to lerp the values:
- ObiVolumeConstraints.overpressure from 0 to 70
- ObiDistanceConstraints.stretchingScale from 0 to 4

I've tried setting this up through a co-routine, or using animations to do so but neither seem to work.

The values do change in the inspector, however it doesn't seem to affect the mesh.

When I modify these values real-time in the editor while running, the mesh responds fine (sliding the values up and down will inflate/deflate the yolk).

Any tips?

Much appreciated!
Thank you <3
(27-01-2019, 09:58 AM)Lozmosis Wrote: [ -> ]Hello devs,

Noob here,

I'm trying to set up some nice egg/yolk physics.

One of the things I'm trying to do is to have the soft body yolk inflate from the cracked egg like a balloon.

The way I've found that would work is to lerp the values:
- ObiVolumeConstraints.overpressure from 0 to 70
- ObiDistanceConstraints.stretchingScale from 0 to 4

I've tried setting this up through a co-routine, or using animations to do so but neither seem to work.

The values do change in the inspector, however it doesn't seem to affect the mesh.

When I modify these values real-time in the editor while running, the mesh responds fine (sliding the values up and down will inflate/deflate the yolk).

Any tips?

Much appreciated!
Thank you <3

Hi there!

You need to call PushDataToSolver() after modifying the constraints. See:
http://obi.virtualmethodstudio.com/tutor...aints.html