Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why solver will suddenly stop?
#1
1 The whole scene have a floor and many soft ball on floor. when I run ,I manual rotate the floor fast. I found sometime solver stop suddenly.
   Any idea?

2 I want to get position of ball, how to coding?

Thanks
Reply
#2
Quote:The whole scene have a floor and many soft ball on floor. when I run ,I manual rotate the floor fast. I found sometime solver stop suddenly.

Can you record a video of this happening? there's no reason for a solver to stop.

Quote:I want to get position of ball, how to coding?

Softbodies automatically update their transform. So you can just do:
Code:
Vector3 position = ball.transform.position;
Reply
#3
video: https://pan.baidu.com/s/1HZ1lmg_O0eRIHo7zkSyvkg

another video: https://pan.baidu.com/s/12jOc-bj01KJie2sKl2SgkA
Reply
#4
(01-02-2019, 10:45 AM)_gaoyu_ Wrote: video: https://pan.baidu.com/s/1HZ1lmg_O0eRIHo7zkSyvkg

another video: https://pan.baidu.com/s/12jOc-bj01KJie2sKl2SgkA

Hi,

This is because you have "simulate when invisible" disabled in your solver. So when the ball goes out of the camera frustum, the solver stops simulating to save performance (instead of simulating something that cannot be seen). Simply enable this setting.

See:
http://obi.virtualmethodstudio.com/tutor...olver.html
Reply
#5
ball.transform.position is incorrect

I was wrong  you are right

I found function in ObiActor.cs
public Vector3 GetParticlePosition(int index)

how to get "index"?
Reply
#6
(01-02-2019, 11:09 AM)_gaoyu_ Wrote: ball.transform.position is incorrect

I was wrong  you are right

I found function in ObiActor.cs
public Vector3 GetParticlePosition(int index)

how to get "index"?

Hi,

Read the documentation on particle scripting:
http://obi.virtualmethodstudio.com/tutor...icles.html
Reply
#7
Hi,
I want to know how to reset particle’ position  during simulation?
Reply
#8
(01-02-2019, 12:16 PM)_gaoyu_ Wrote: Hi,
I want to know how to reset particle’ position  during simulation?

Hi,

simply assign the rest position to the position:
Code:
solver.positions[ball.particleIndices[i]] = ball.restPositions[i];

Note that this will reset the actor to the center of the scene, since restPositions are expressed in local space, while solver positions are expressed in world space. You might want to convert them using Unity's TransformPoint or InverseTransformPoint methods, It depends on whether you want to reset its deformation only, or completely reset all positions.
Reply