We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi all,
I am slowly getting familiar with toxiclibs. I am using the WindgedEdge class.
I have this forloop at some point:
for (WingedEdge e : custom.edges.values ()) {
VerletParticle a = physics.particles.get(((WEVertex) e.a).id);
VerletParticle b = physics.particles.get(((WEVertex) e.b).id);
physics.addSpring(new VerletSpring(a, b, a.distanceTo(b), 0.005f));
}
What I want to do is to add an if condition to add a spring to certain edges (not all of them). So I need to get certain items. But I don't figure out how to do it, even by checking the API. http://toxiclibs.org/docs/core/toxi/geom/mesh/WingedEdge.html
Any help would be greatly appreciated.
Best
Answers
Is the If-clause the problem? What property do you want to check? What have you tried? What happened?
No, the if condition is not the problem, I just cannot figure out how to get specific indexes with this class
I append all the Verletspring in an empty arraylist and tried to get certain item from this list to add a new spring... But then I got the following error: "The method addSpring(VerletSpring) in the type VerletPhysics is not applicable for the arguments (Object)".
Here is the updated code:
If you specify what is going into the ArrayList, like this:
springness = new ArrayList<VerletSpring>();
the compiler shouldn't be confused about what should be coming out when you use get(...).
like
thank you guys, it worked :)