Hi, I have what seems to be quite a weird problem in my code (I can discuss the issue and answer questions but cannot post big chunks of my code due to code sharing rules on this class project)
I have a class called Particle which represents particles in 3d space. One of its' private attributes is its' velocity.
This velocity is of type Vector (Vector being a class defined in another part of the program with many useful methods such as dot product etc), and has size 3.
I have written a public function in the Particle class which is called as follows from the main when a collision is detected between (say) particle1 and particle2 to calculate the new velocity vectors.
Everything is working well, I have gone through the debugging process to inspect variables and the results obtained by the bounce function are all correct.
However, at the end of the function when I try to put a result into the velocity attribute for particle2 by doing
particle2.velocity = someObjectOfTypeVector
and I get
This is weird because the line before puts a result into the velocity attribute for particle one I wrote
velocity = someObjectOfTypeVector
and this works fine, even with the debugger I can see that the velocity attribute of particle1 has been correctly updated.
This is really annoying because I need to move onto the last leg of the project which is implementing OpenGL and can't find a solution elsewhere on the internet so any help would be much appreciated :)