(19-07-2024, 06:04 PM)mayktr Wrote: public void Swerve(Vector3 targetPos, float speed)
{
Vector3 newPos = Vector3.MoveTowards(selectedGO.transform.position, targetPos, speed * Time.fixedDeltaTime);
myRigidbody.MovePosition(newPos);
...
}
Here is the code that I am moving my ball. By the way, I am calling this method from FixedUpdate.
I have added ObiRigidbody to my rope but thanks to your advice I have removed both ObiRigidbody and Rigidbody. But still having same problem.
Also how can I get trigger detection with other box colliders with trigger checkbox on?
Hi,
This isn’t a force of any kind, it will set the position of the sphere while completely ignoring physics. The rope has no option but to follow the ball, since it can't affect/limit its movement in any way once the rope is completely taut.
You need to use forces/accelerations/velocities if you want physical effects to take place, this applies to any physics engine you use. In Obi this can be done by using AddForce on the rope, writing per-particle forces to the solver’s
externalForces array, or using
dynamic attachments. You’ll find examples of these in the sample scenes, eg: the Crane and FreightLift sample scene use dynamic attachments to rigidbodies, the Firehose sample scene uses externalForces to allow you to click and drag the rope around while respecting physics (the rope won’t overstretch, clip trough other objects or itself).
In your specific case I think you should move the sphere rigidbody using AddForce (and ensuring the rigidbody is not kinematic, otherwise it will ignore forces applied to it!). Dynamic attachments allow forces applied on the rigidbody attached to affect the rope and vice-versa, but for this to work
you need to use forces to begin with.
In addition to this, check the
collision filters on your rope's control points (select the rope, click the "edit path" button, select the control points and check the "collides with" and "category" values). These can disable collisions between entire portions of the rope, which may be preventing your ropes from colliding with each other.
Let me know if you need further help,
Kind regards,