01-11-2017, 11:23 AM
Thank you very much for your help, but how do i know the new position of each particle?
I need to add all Particles once, and than i need to move the handler where my "hand" is.
But the problem is, how to add all Particles, how do i know the new position of them?
This is in my Init void:
And this in FixedUpdate to move the Handler:
In the Attachment you can see, how it looks, when i pick the rope up.
I need to add all Particles once, and than i need to move the handler where my "hand" is.
But the problem is, how to add all Particles, how do i know the new position of them?
This is in my Init void:
Code:
m_handleGO = new GameObject("Obi Handle");
m_handle = m_handleGO.AddComponent<ObiParticleHandle>();
m_handle.Actor = m_rope;
// Add the selected particle(s) to the handle:
for (int i = 0; i < m_rope.invMasses.Length; ++i)
{
m_handle.AddParticle(i, m_rope.GetParticlePosition(i) / m_rope.invMasses[i], m_rope.invMasses[i]);
}
And this in FixedUpdate to move the Handler:
Code:
m_handleGO.transform.position = Vector3.Lerp(transform.position, PlayerCamera.Instance.transform.position + PlayerCamera.Instance.transform.forward * .8f, Time.deltaTime * 20);
In the Attachment you can see, how it looks, when i pick the rope up.