Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Changing values procedurally via code
#1
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
Reply
#2
(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
Reply