Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get rope speed, velocity and angle
#3
(01-10-2021, 06:32 AM)lacasrac Wrote: What is the best way to get the rope swing  speed, velocity? Also get an angle of two particle?

private Vector3 GetVelocity()
{
    int index = 0;
    int actorIndex = 0; //solver.actors[index].solverIndices.Count() / 2;
    var solverIndex = solver.actors[index].solverIndices[actorIndex];
    Vector3 velocity = solver.velocities[solverIndex];
    Debug.Log("velocity v3 " + name + " " + velocity + " " + solverIndex);
    return velocity;
}

What is the probleme with this code? I added the rope from code, and I want to get the velocity of the rope's half height's particle. How can I do that?
I only get 0 always.


(04-10-2021, 01:12 PM)lacasrac Wrote: private Vector3 GetVelocity()
{
    int index = 0;
    int actorIndex = 0; //solver.actors[index].solverIndices.Count() / 2;
    var solverIndex = solver.actors[index].solverIndices[actorIndex];
    Vector3 velocity = solver.velocities[solverIndex];
    Debug.Log("velocity v3 " + name + " " + velocity + " " + solverIndex);
    return velocity;
}

What is the probleme with this code? I added the rope from code, and I want to get the velocity of the rope's half height's particle. How can I do that?
I only get 0 always.

private
Vector3 GetVelocity()
{
    var index = _rope.activeParticleCount - 1;
    var solverIndex = _rope.solverIndices[index];
    return solver.velocities[solverIndex];
}


this is working, but I don't know this is good or not? Sonrisa
Reply


Messages In This Thread
Get rope speed, velocity and angle - by lacasrac - 01-10-2021, 06:32 AM
RE: Get rope speed, velocity and angle - by lacasrac - 04-10-2021, 01:12 PM