20-12-2019, 10:19 AM
(20-12-2019, 10:02 AM)josemendez Wrote: Quite probably, your rope is colliding with the yellow blocks during the first frame. So it is projected outside, gaining speed, and after the first frame Start() is executed and the rope bound in its current position.
Either:
- Deactivate collisions between the yellow blocks and the first few particles in the rope (recommended), setting either to the same phase as the other (See the last bit ofhttp://obi.virtualmethodstudio.com/tutor...aints.html)
- Force the rope particle group position in Start(), right before setting the target.
Through Awake its fine.
I set the particleGroups made on that BP to 0 collision phase and then by default the ObiCollider is 0 for the block and still same thing.
I then I added this fast into the script to manually set the position tooo
Code:
using UnityEngine;
using Obi;
public class DummyAttach : MonoBehaviour
{
public Transform target;
private ObiRope _rope;
private ObiParticleAttachment _attachment;
private void Start()
{
_rope = GetComponent<ObiRope>();
_attachment = GetComponent<ObiParticleAttachment>();
var index = _rope.solverIndices[0];
var targetPos = _rope.solver.transform.InverseTransformPoint(target.position);
_rope.solver.invMasses[index] = 0f;
_rope.solver.positions[index] = targetPos;
if (target != null)
_attachment.target = target;
//_rope.solver.invMasses[index] = 1f;
}
}
Resetting the mass is commented out because it just did what its been doing which is attaching to that offset we see in the gif. Not resetting it just attaches it manually with no 2-way physics between the rope and rigidbody which is good for just positioning but I really enjoy the new attachment system and would like to attach through runtime.