Obi Official Forum
Help Changing values procedurally via code - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Cloth (https://obi.virtualmethodstudio.com/forum/forum-2.html)
+--- Thread: Help Changing values procedurally via code (/thread-835.html)



Changing values procedurally via code - Lozmosis - 27-01-2019

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


RE: Changing values procedurally via code - josemendez - 27-01-2019

(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/tutorials/scriptingconstraints.html