Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Softbody Scale
#1
Hi,

I have a softbody car and it is moving through x axis in 2d mode. I would like scale at the same time when I try to change scale of Obi Solver the car suddenly jumps forward because Obi solver scales from its centre. Is there any trick to solve this problem. I used LateUpdate to solve this problem. I am positioning car at late update but its position doesn't set.
Reply
#2
(18-01-2023, 07:48 PM)patriot4947 Wrote: Hi,

I have a softbody car and it is moving through x axis in 2d mode. I would like scale at the same time when I try to change scale of Obi Solver the car suddenly jumps forward because Obi solver scales from its centre. Is there any trick to solve this problem.

Hi!

Yes, you can translate the solver as well as scaling it. If you scale it by 0.5 in the X axis, translating it by 0.5*softbody.localPosition.x should keep the softbody from moving.

(18-01-2023, 07:48 PM)patriot4947 Wrote: I used LateUpdate to solve this problem. I am positioning car at late update but its position doesn't set.


You can't set the position of a softbody by setting its transform: it's made up of multiple particles, you need to move the particles themselves to translate it. You might want to do this manually using the particles API, or use softbody.Teleport(position, rotation);
Reply
#3
(19-01-2023, 08:59 AM)josemendez Wrote: Hi!

Yes, you can translate the solver as well as scaling it. If you scale it by 0.5 in the X axis, translating it by 0.5*softbody.localPosition.x should keep the softbody from moving.



You can't set the position of a softbody by setting its transform: it's made up of multiple particles, you need to move the particles themselves to translate it. You might want to do this manually using the particles API, or use softbody.Teleport(position, rotation);


I already tried your formula but for some reason it didn't work (Some errors occurred and I supposed these errors depend on the Obi package.). I made clean demo and everything worked fine.

Thanks for your quick answer.
Reply