I have a box defined by width, height and depth. I want the camera to keep looking at the centre of the box (width/2, height/2, depth/2) and move around in a constant rate, in the XY plane, which defines width and height.
but haven't succeded (width and height are from the screen size and depth is an average of those).
I'd also probably like to make this using peasycam to keep the hud it makes... but of course I could just block the mouse and keep the peasycam there... just because of the hud.
I'm trying to register every Nth point within and array to an arraylist so I can later include those to a sorted array and compare distance, in some sort of a flocking behaviour. The first array determines a tail for the agent, the arraylist is the collected info and the second array is the sorted list. Here's the code part of it:
I've been doing a sketch which involves series of spheres which I need to simulate but, for the time being, I'm using circles to avoid the lagging due to having to process a huge amount of faces from a sphere (My sketch involves about 5.000 individual cells). I've found quite interesting effects you could achieve by simply scaling sizes and opacities with circles, using way less memory than volumetric shapes.
The problem is that, when I rotate the camera, because it is in the xy plane, the beautiful circular shape becomes a plane.
I was wondering if there's a way to draw another set of circles in a different plane (say xz or yz... or both) to allow the camera rotation to maintain the effect I'm using.
I'm working on a double layered agent system and trying to get a float from one to the other. I just realised it doesn't work with the same method than a vector, which I use quite successfully. I'm trying something like this:
void Feed() {
if (Fenergy < FmaxEnergy*.5) {
// Roll over the cell and check the Flockers within
for (int j = 0; j < FlockersCollection[newCell].size(); j++) {
Voxel V = (Voxel) VoxelCollection[newCell].get(j);
I've been trying to generate an array to support a flocking bunch of points in 3d, which seems to be kind what you should do if you want to reduce processing time per agent.
After a while, I'm bumping against a NullPointerException which I haven't been able to trace.
Any ideas on where should I look at?
Just for the record, I'm not too advanced on processing (but very enthusiastic) so, please, don't make too complex answers... Thanks!
Oh... there goes my code (which is not entirely mine, but I'll give the credits when I finish it... up to now...
//Libraries
import processing.opengl.*;
import peasy.*;
//Global variables
float align = 5; // Distance for Flockers to follow each other.
float avoid = 1; // Distance to move away from each other
float cohesion = 2; // A factor to keep the Flockers crowding
float multiplier = 25; // an adjustment multiplier
int maxFlockers = 10000; //maximum number of Flockers to be generated
PeasyCam cam; // The camera to be used
float minDist = 100; //The local area for the Flockers to be aware of
public PVector velocity; // A public vector to transfer values and draw with them
public int gridSize = 50; // A measure for the onscreen grid
public int Rows, Cols, Stacks, Cells;// Integers to store the number of gridcells per axis
ArrayList[] FlockersCollection; // The array to store the arraylists
I'm kinda halfway through a mid term project, which I'm trying to make progress from a very simple sketch into a more complex one, involving proximity detection, arrays, particles spawn, death, growing and shrinking. Up to now, I'm in the proximity detection stage, using the core processing library but I'm starting to wonder if it's a good idea to migrate right now into toxic libs, before the sketch gets too complex and I have to figure too many things out to switch. it could be of interest that I'm not a very experienced programmer.
The decision factor, because of the amount of processes and interactions to be considered, is speed, so the question is (sorry for the caps but it's for focussing) IS TOXIC LIBS FASTER THAN CORE PROCESSING LIBRARY WHEN IT COMES TO MANY INTERACTIONS?