Scaling SoftBody objects in run-time in Unity3D

Post Reply
manpower13
Posts: 1
Joined: Fri Jan 25, 2019 7:46 pm

Scaling SoftBody objects in run-time in Unity3D

Post by manpower13 » Fri Jan 25, 2019 8:08 pm

Hello everyone!

First of all, thank you for the amazing work (but you probably hear that a lot ^^).

I'm working on a SoftBody project in Unity. I'm using https://github.com/Phong13/BulletSharpUnity3d as a wrapper, which seems to be working fine.

Background info:
I have a SoftBody object, which is controlled by a RigidBody (using btSoftBody_appendLinearJoint3). The RigidBody object is controlled by keyboard input that applies forces (or impulses) to the RigidBody. You can see a GIF here that shows the result. The SoftBody uses a 3D model based on triangles.

What I want:
I want the SoftBody to scale while playing. By a button press, by a trigger in the scene or just random. A function that rescales it is all I need.

What is working:
The RigidBody is scaling and collisions update. This is done using btCollisionShape_setLocalScaling.

What I tried:
Calling btSoftBody_scale with the appropriate arguments. This results in the SoftBody being weirdly deformed and getting a huge impuls. This impuls results in the SoftBody being shot away. The SoftBody is however bigger than it was.
I tried first removing the SoftBody from the world, applying scale and then adding the object again, but this didn't seem to work as well (besides that it seemed to be very slow).
I tried using the btSoftBody_Pose_setScl method.

I read the BulletPhysics documentation again, but I just don't understand what I need to call. It seems like I need to call a method before doing scaling and after scaling. So that while scaling no weird forces are added and so that the SoftBody scales its original shape, not the deformed one.

Since there is not a lot of documentation about SoftBodies, I hope someone can help me here! If you need any more information, don't hesitate to send me a message :)

Thank you for reading!
Sincerely,
Floris Weers

Post Reply