This is more of a curiosity than an actual problem, but I made a class that extends Geometry and I noticed 2 things.
Normally the Geometry constructor assigns a ‘name’ to the geometry. What is the purpose of the name? And if it is important to assign one, than how do I assign one in the constructor of my class that extends Geometry?
In my extended class I created a variable called mesh. The editor complained that mesh was hiding a field. Does that mean that the class Geometry already uses a variable called mesh? Will using my own variable mesh cause unexpected behavior?
Thank you for clearing that up. Still, one last thing. What’s the purpose of the ‘name’ on a shape or geometry object? Or a mesh for that matter? Most of these constructors ask for a name. What are the names used for?
Ah alright. I’m still rather new to jMonkey and haven’t yet used getChild. Suddenly it’s really obvious why a name would be useful. So far I’ve just been sticking to reference variables, often stored in arrays. Thank you : )
Oh, why is it ‘bad’ to extend Geometry? Is it just a general programming precaution? Because the code I created from doing it is rather elegant and clean. But if it’s going to get me in trouble down the road than I’d rather avoid it.
I can understand that, makes sense. And my mesh field was used to point to a mesh that will be attached to the extended Geometry node but hasn’t been attached yet. The reason for that being is so that the mesh may be modified before rendering by method calls from external sources.
But as I am going to be adding larger control structures into the code I’ll switch over to composition. Thanks for the tips ^.^