Quote:Original post by Washu
Couple of ways, but I have to question WHY you want to do that?
Let me explain what i'm trying to accomplish;
I'm making a soft body physics Sim. Like most, it will calculate the forces and bonds between atoms/nodes. The program is made from three main parts:
>Program.cs (turns the simulation into a usable piece of software, adds GUI, etc)
>Physics.cs (is called to calculate the forces, and derive new positions, velocities, etc)
>Renderer.cs (uses data about the currant game state to draw a representation of the scene)
As you can see, all these classes need to have access to the data stored in the "Node"s in the nodes array.
Quote:Original post by Washu
A better choice would be to simply pass the list of nodes straight to the concerned object
Considering that i would need to pass the nodes, and all of the information stored in them, constantly, throughout the execution of the program; (if i wanted a frame rate of 30, i would need to pass the nodes, with their updated information, to the renderer, 30 times a second. And i would need to do the same thing for physics) would this really be efficient?
Quote:Original post by TheOrzo
The Batfrog, if you don't mind me asking (not trying to be condescending), are you new to programming?
No, i'm not really new; I've been learning for about 2 years now, but before that i was learning bits and pieces, as early back as 7 years ago. I guess it wouldn't be strange if i had forgotten something i learnt back then, that is hindering me now. Maybe it might be time for me to break out some old programing books, and re-read the first chapters.
Quote:Original post by TheOrzo
Scope.
So what your saying is that if i declare and initialize the array in the namespace, but outside of the classes, i should be able to access it from any class?