16-06-2025, 01:40 PM
(This post was last modified: 16-06-2025, 01:50 PM by chenji.
Edit Reason: add disclaimer
)
(16-06-2025, 12:06 PM)quent_1982 Wrote: but there’s still a big noticeable gap between the player’s hands and the rope when rotatingI had similar question before when I tried to implemente a "a person hold a fishing rod&rope, and rotate the person" scenario. The difference is I'm using attachment instead of pinhole but I think it's similar. Basically you need to check below things:
- You'd better use AddTorque (physics related) to rotate anything, instead of changing GameObject's transform(only affect visual), if you want the rope's behavior close to real world one.
- Try to use Synchronous Fixed mode https://obi.virtualmethodstudio.com/manu...eloop.html
- Try to add substeps of solver to see whether it's better
- Check Interpolation of your Rigidbody. Make sure they are same with Obi Solver.
- To inject world space angular inertia into the simulation set the solver's world space angular inertia to a non-zero value
- Check the Obi/rigidbody colliders of the conterpart of the problem. For example, if your problem is A and B has a gap, check whether A and B has collisions. Try disable their collision to see whether it works.
- You may manually align the position in every simulation step. Like below (though it breaks the physics simluation result, make sure it's suitable in your scenario, if you want to use this approach):
{
solver.OnInterpolate += RopeSolverInterpolate;
}
private void RopeSolverInterpolate(ObiSolver solver, float timeToSimulate, float substepTime)
{
int firstParticle = rope.elements[0].particle1; //Get the particle you want to move
solver.renderablePositions.SetVector3(firstParticle, solver.transform.InverseTransformPoint(TheObjectInYourScenario.transform.position));
}