Thanks Kevin and Phil. Sticking a reference to the object I need in the user data is a good idea. The only drawback is that I need to travers my scenegraph after having loaded it and stick that reference in every node that can be picked - a bit of a time-suck and space user for large scenes.
I will try enabling pick reporting too. Perhaps if I enable pick reporting for only the branch groups I'm interested in the scene graph path will contain only those nodes... hmmm.. I'll give that a shot first. Josh >>> [EMAIL PROTECTED] 03/03/03 09:34AM >>> Sure, data object isn't really a special term, I just mean an object to store your data. For instance, in my application I have a player who wanders round a world. For my player I have a J3D branch group called "Actor3D", actually actor 3d represents any "actor" in the game (monsters, NPCs etc). The object I put in the user data is a set of data about which particular create the shape is representing. For instance, my player object knows what race it is (hence what model to use), what its wearing, and its name. In you case you could just have an object that "wraps" up all the data you want to store about the "thing" that the shape3d represents. So all you doubles/floats/strings get stuck inside this one object. When you pick the shape3d you pull out the user data and can just access the data without having to parse any strings (or such like). Its quite similar to a model/view standard OO pattern. The 3d world is just a view of the data that you are modelling. Obviously, just my view on things, Kev > Kevin > > Told you it may not be 100% accurate! Could you tell me what you mean > by a data Object? I have to store doubles, floats and strings in my > User data how would a data object benefit me? Only been looking a t > Java for around a year now so new things are always poping up so a dta > Object must be one of them! any suggestions? > > C YA Phil :) > > >>===== Original Message From Discussion list for Java 3D API > <[EMAIL PROTECTED]> ===== >>> Hi Josh >>> >>> Not an expert on this but being as I have been doing a fair bit with >>> picking lately I thought I mioght have a crack at helping you. It is >>> not possioble to get the parent of an object at runtime but I find >>> two things are needed to solve you problem. firstly if the >>> scenegraph path objcet will only return objects that have the correct >>> capability set (pick reporting I think!). Secondly carefully design >>> the >>> ".userData(Object obj)" then user >>> setUserData(obj); and >>> new oBj = getUserData() >>> >>> Then I use a string that I frmat and tokenise on reading it to get >>> all the required data I need. e.g Parents name, Translational >>> vectors (needs casting back into double or floats after reading from >>> the stringTokeniser()) and even if their are children attached. >>> >> >>Just a slight addition. It might be nicer (and more efficent) if you >> store a specifically designed data object in the user data. Then you'd >> have all your data readily available and typed as soon as you got your >> picked node, instead of parsing the string. >> >>> Hope this helps. >>> >>> C YA Phil :) >>> >>> >>> >>>>===== Original Message From Discussion list for Java 3D API >>> <[EMAIL PROTECTED]> ===== >>>>Hi, >>>> >>>>I've been using the PickCanvas for some time now to pick 3D points in >>>> my >>> scene. Now I'd like to be able to distinguish which avatar was >>> picked.. not just the Shape3D. I had the "bright" idea to extend >>> BranchGroup with a class that includes a reference to the avatar >>> object thinking that I could chase this parent up from the leaf that >>> is picked. Of course when I tried this I get the restricted access >>> exception. >>>> >>>>Is there an easy way to do this? >>>> >>>>I looked at the result returned by getSceneGraphPath but it always >>>> claims to >>> have 0 nodes! (nodeCount() == 0). >>>> >>>>josh >>>> >>>>To unsubscribe, send email to [EMAIL PROTECTED] and include in >>>> the >>>> body of the message "signoff JAVA3D-INTEREST". For general help, >>>> send email to [EMAIL PROTECTED] and include in the body of the >>>> message "help". >>> >>> Philip J Colbert >>> Software Engineer >>> RCID, Bruce Building >>> University of Newcastle Upon Tyne >>> NE1 7RU >>> Phone 0191-2225306 >>> Fax 0191-2225833 >>> This e-mail, including any attached files, may contain confidential >>> and privileged information for the sole use of the intended >>> recipient(s). If you are not the intended recipient, please note that >>> any circulation or copying of this e-mail is strictly prohibited. If >>> you have received this e-mail in error please contact the sender by >>> reply e-mail and delete all copies of this message. >>> >>> The RCID makes every effort to ensure that this e-mail and any >>> attachments are sent virus free. However it is the responsibility of >>> the recipient to perform any checks they deem necessary. >>> >>> =========================================================================== >>> To unsubscribe, send email to [EMAIL PROTECTED] and include in >>> the body of the message "signoff JAVA3D-INTEREST". For general help, >>> send email to [EMAIL PROTECTED] and include in the body of the >>> message "help". >> >> >>-- >>Jose UML - http://www.newdawnsoftware.com/jose >>Pondering RPG - http://pondering.newdawnsoftware.com >> >>=========================================================================== >> To unsubscribe, send email to [EMAIL PROTECTED] and include in the >> body of the message "signoff JAVA3D-INTEREST". For general help, send >> email to [EMAIL PROTECTED] and include in the body of the message >> "help". > > Philip J Colbert > Software Engineer > RCID, Bruce Building > University of Newcastle Upon Tyne > NE1 7RU > Phone 0191-2225306 > Fax 0191-2225833 > This e-mail, including any attached files, may contain confidential and > privileged information for the sole use of the intended recipient(s). If > you are not the intended recipient, please note that any circulation or > copying of this e-mail is strictly prohibited. If you have received this > e-mail in error please contact the sender by reply e-mail and delete all > copies of this message. > > The RCID makes every effort to ensure that this e-mail and any > attachments are sent virus free. However it is the responsibility of the > recipient to perform any checks they deem necessary. > > =========================================================================== > To unsubscribe, send email to [EMAIL PROTECTED] and include in the > body of the message "signoff JAVA3D-INTEREST". For general help, send > email to [EMAIL PROTECTED] and include in the body of the message > "help". -- Jose UML - http://www.newdawnsoftware.com/jose Pondering RPG - http://pondering.newdawnsoftware.com =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help". ==========================================================================To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
