Creating a chain from 2 fixed points??
in
Programming Questions
•
2 years ago
Hi guys,
quick question....what is the best way to create a chain locked at either end which consists of points equidistant from one another connected by springs? I know how to do this if the chain is parallel to an axis, e.g.
for (int i = 0; i < 10; i ++) {
Particle p = new Particle (i*10, 0, 0);
}
but what if the direction of the lines is random? My initial thoughts are to calculate the distance between the vectors of the 2 static points and divide by (for example) 10 and place a point at each new vector.
Does this sound sensible? Does anyone have any examples of this?
I've attached an image of a sketch I have just done but the static points are connected by a single line and not a chain of points and springs.
Many thanks, Farley
quick question....what is the best way to create a chain locked at either end which consists of points equidistant from one another connected by springs? I know how to do this if the chain is parallel to an axis, e.g.
for (int i = 0; i < 10; i ++) {
Particle p = new Particle (i*10, 0, 0);
}
but what if the direction of the lines is random? My initial thoughts are to calculate the distance between the vectors of the 2 static points and divide by (for example) 10 and place a point at each new vector.
Does this sound sensible? Does anyone have any examples of this?
I've attached an image of a sketch I have just done but the static points are connected by a single line and not a chain of points and springs.
Many thanks, Farley
1