We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello. I am creating an app where I use an own modified version of Traer Physics library, hence a ParticleSystem with many nodes. The modifications I have made to the Node class were adding a unique PID, the parent_ID and a children arraylist.
I have also implemented functions for erasing, adding, editing and even moving nodes (particles), however copying is being quite difficult for me, since every thing I try, makes a shallow copy of the nodes (and I would need a unique_id per node).
How could I implement that functionality?
The class ParticleSystem just uses arraylists of other classes as Particles (node), attraction, etc.
//package traer.physics;
//import java.util.*;
public class ParticleSystem
{
public static final int RUNGE_KUTTA = 0;
public static final int MODIFIED_EULER = 1;
protected static final float DEFAULT_GRAVITY = 0;//1.0f; //0;
protected static final float DEFAULT_DRAG = 0.001f;
ArrayList particles = new ArrayList();
ArrayList springs = new ArrayList();
ArrayList attractions = new ArrayList();
ArrayList customForces = new ArrayList();
ArrayList pulses = new ArrayList();
Integrator integrator;
PVector gravity = new PVector();
...
To make clear my architecture, I post a snapshot of it:
Thank you