This week's book giveaway is in the NodeJS forum. We're giving away four copies of Serverless Applications with Node.js and have Slobodan Stojanovic & Aleksandar Simovic on-line! See this thread for details.
Ok here is a good one ... I want to develop an RTS with java 3d, I have everything going well except for one major factor ... how do I select objects in the scene ... here is what I mean. I built a few models with anim8or, I them load these objects into the scene graph, here is an example ...
Each object is loaded into a prop manager ... and each object is a subclass of Sprite3D which is a subclass of shape3D
Ok now the spite class
Now subclass Sprite3D to creat all kinds of objects ... for an example we load in a model of the earth ...
Ok I know this is long so bare with me, now in the main game class we load the object and a PicKMouseBehavior like so ...
Now here is the SelectObjectBehavior wich is a subclass of PickMouseBehavior
Ok here is my belema, I set the userdata() when the earth object is created, but when the object is clicked in 3d space the userdata() is null, why is this?? The object seems to no longer be a subclass of earth, so I have no access to variables such as name or population if I wanted to add them. If I pass a reference to the behavior then I can get access to the object but that doesn't help if I pick something other than earth. What is going on? I know this is a complicated subject so I hope someone out there can help, I've posted this in a few places and still after a week no help ... :-( Keep in mind the type of game I want to write ... its an RTS game Real Time Strategy ... games like command and conquer, world in conflict, game like that. I must be able to select an object and get the data from the class it is built from.
That's way to much code to dig through without me having anything to test it with, and I doubt anyone else will either. I'd recommend using a good debugger and adding break points in your code. Have a break point at the code that gets activated when you click on a unit. Go inside the variable and see what it's doing and why it's not returning what you thought was there. I would also add some print methods to the entire initialization so that you can see if your even adding units to the earth to begin with. I've had multi-week bugs myself and they are no fun, but you know the code better than anyone so you're the only one who can fix it.
~Currently preparing for SCJP6
Willie Smits can speak 40 languages. This tiny ad can speak only one:
global solutions you can do at home or in your backyard