Hi all,

I'm trying to create code which manipulates data within a vector. The vector contains floating points which store consecutive 3D values. For example element 1 stores object 1 x coords, element 2 - object 1 y coords, element 3 - object 1 z coords, element 4 object 2 x coords etc.

My problem, is I am trying to update the vector by replacing the values for the 3rd object x,y and z with the second objects, and then putting in new data for the first.

void shuffleArray()
	int a = 4;
	for (int c = 0; c < bodyPos.size()-3; c++) {
		bodyPos[a] = bodyPos[c];

This however won't work as it is only ending up with the first 3 elements.



First, I'd like to ask why you don't have a vector of 3-D Points with each point containing its own x, y, and z coordinates.

I think you would find solving your problem substantially easier if you did.

If you choose to keep it the way you have it, I would suggest you look into the vector::insert() member function.