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.
Win a copy of Serverless Applications with Node.js this week in the NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

Picking With Java 3D  RSS feed

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
lowercase baba
Posts: 12734
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I doubt anyone is going to read your 800+ lines of code to debug your problem. is there any way you can simplify it, and only post the relevant portions?

You should probably read some of this, but in particular this one.
Ranch Hand
Posts: 488
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Willie Smits can speak 40 languages. This tiny ad can speak only one:
global solutions you can do at home or in your backyard
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!