28-02-2024, 10:07 AM
(This post was last modified: 28-02-2024, 10:09 AM by BusraSevim.)
Hello,
In my scene, there is a normal rotating cylinder and softbody spheres arranged around this cylinder. In order to attract the center of the cylinder, I apply a force to all spheres as follows:
But at the same time, the cylinder is the parent object of these spheres. And when I rotate the cylinder, I want these spheres to rotate with the cylinder, like normal spheres. But they don't rotate, I can only see the strain vibration. They can rotate when I turn off the softbody features, but I shouldn't turn them off.
The rotation code of the cylinder is as follows:
I use the solver and sphere softbody features in the sample scene named BallPool.
Thanks.
In my scene, there is a normal rotating cylinder and softbody spheres arranged around this cylinder. In order to attract the center of the cylinder, I apply a force to all spheres as follows:
Code:
var forceDirection = (spin.transform.position - transform.position).normalized;
softBall.AddForce(forceDirection * force, ForceMode.Acceleration);
But at the same time, the cylinder is the parent object of these spheres. And when I rotate the cylinder, I want these spheres to rotate with the cylinder, like normal spheres. But they don't rotate, I can only see the strain vibration. They can rotate when I turn off the softbody features, but I shouldn't turn them off.
The rotation code of the cylinder is as follows:
Code:
transform.Rotate(Vector3.forward,-_inputVector.x*spinRotateSpeed);
I use the solver and sphere softbody features in the sample scene named BallPool.
Thanks.