Obi Official Forum
Softbody positioned far from the world origin move toward the origin unexpectedly - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Softbody (https://obi.virtualmethodstudio.com/forum/forum-12.html)
+--- Thread: Softbody positioned far from the world origin move toward the origin unexpectedly (/thread-1212.html)



Softbody positioned far from the world origin move toward the origin unexpectedly - kenjis - 31-05-2019

Hi,
I faced unexpected behavior of a softbody positioned far from the world origin.

Repro:
1. open BallPool sample scene.
2. create new GameObject with its name is 'Parent', its position is (0, 0, 0).
3. move existing GameObjects of 'Main Camera', 'TestEnvironment', 'ActorSpawner' and 'Ball' to under 'Parent' (to be Parent's children).
4. change Parent's position.x = 10000 (here, dare large)
changed like this
[attachment=359]
5. play the scene

Result:

The ball falls down and also moves rightward as like horizontal force was added.
It should fall down only along Y axis.
Might think the ball goes back to the world origin.

Do I missing setup something?
Thanks


RE: Softbody positioned far from the world origin move toward the origin unexpectedly - josemendez - 31-05-2019

(31-05-2019, 05:20 AM)kenjis Wrote: Hi,
I faced unexpected behavior of a softbody positioned far from the world origin.

Repro:
1. open BallPool sample scene.
2. create new GameObject with its name is 'Parent', its position is (0, 0, 0).
3. move existing GameObjects of 'Main Camera', 'TestEnvironment', 'ActorSpawner' and 'Ball' to under 'Parent' (to be Parent's children).
4. change Parent's position.x = 10000 (here, dare large)
changed like this

5. play the scene

Result:

The ball falls down and also moves rightward as like horizontal force was added.
It should fall down only along Y axis.
Might think the ball goes back to the world origin.

Do I missing setup something?
Thanks

Well, you're facing floating point precision problems. Shape matching constraints are specially sensitive to it. This is not at all unexpected, and one of the reasons why local space simulation exists. See:

http://obi.virtualmethodstudio.com/tutorials/localspace.html

Quote from local space sim advantages:
Quote:The simulation can be very far away from the world's origin and still retain excellent floating point precision, as all quantities are expressed with respect to the solver's transform.

So the solution in this case would be to switch from world space sim to local space sim.

cheers,


RE: Softbody positioned far from the world origin move toward the origin unexpectedly - kenjis - 31-05-2019

(31-05-2019, 07:12 AM)josemendez Wrote: Well, you're facing floating point precision problems. Shape matching constraints are specially sensitive to it. This is not at all unexpected, and one of the reasons why local space simulation exists. See:

http://obi.virtualmethodstudio.com/tutorials/localspace.html

Quote from local space sim advantages:

So the solution in this case would be to switch from world space sim to local space sim.

cheers,

Hi,
Than you for quick response!

Yes, exactly it became not caused in local space simulation.

But I came to another problem in case of local space simulation, it is that visual of the ball (in faraway) and its transform (in wold's origin) get apart.
I'm thinking of attaching unity collider to ObiSoftbody to interact in unity standard ways such as collision, Physics.raycast, and so on...

Is there any way to keep visual and transform of softbody at the same position in local space simulation?
Thanks