HI Andreas,
Java3D Cylinders, Spheres and Boxes etc are all subclasses of Primitive which
in turn is a subclass of Group. Each of these Groups has a number of
child Shape3D's depending on the shape (sphere has 1 Shape3D, Cylinder 3 etc).
When you call setUserData on the Cylinder you are actually setting the
userData property on the Group, not it's children.
When you call getUserData on the object returned by picking you are calling
it on one of the child Shape3D objects which have not been set.
So you either need to set the userData property on every child of the Primitive
or traverse up the sceneGraphPath from the picked object until you find
the Primitive.
Hope this helps
Paul
----------------------------------------------------------
Paul Byrne Email : [EMAIL PROTECTED]
Sun Microsystems Phone : (650) 786 9926
Visualization Software Group Fax : (650) 786 5852
----------------------------------------------------------
>Delivered-To: [EMAIL PROTECTED]
>MIME-Version: 1.0
>Date: Wed, 27 Jun 2001 17:23:04 -0700
>From: Ashish Aggarwal <[EMAIL PROTECTED]>
>Subject: Re: [JAVA3D]
>To: [EMAIL PROTECTED]
>
>Andreas!
>
>why don't u run the program and see yourself. That's
>not the problem. I made changes according to what you
>are saying and still getUserdata is returning null.
>Can you help me in this.
>
>Bye
>
>
>--- Andreas Kemkes <[EMAIL PROTECTED]> wrote:
>> Try
>>
>> ...
>> cg[count] = (Point3d)myShape.getUserData();
>> System.out.println(cg[count]);//returning null
>> count += 1;
>> ...
>>
>> You were still not accessing the same element.
>>
>> Andreas
>>
>> Ashish Aggarwal wrote:
>> >
>> > Hello!
>> >
>> > That's not the problem. Andreas, try to run the
>> > program and then see the result. I ran the program
>> by
>> > changing it but still getUserData returns null.
>> >
>> > Please can anybody help me.
>> >
>> > Thanks
>> >
>> > --- Andreas Kemkes <[EMAIL PROTECTED]>
>> wrote:
>> > > By using count++ twice, you access a different
>> > > element than you
>> > > stored your value in.
>> > >
>> > > Andreas
>> > >
>> > > Ashish Aggarwal wrote:
>> > > >
>> > > > hello!
>> > > >
>> > > > Can somebody help me:
>> > > >
>> > > > I have a box and cylinder in the screen. I
>> want to
>> > > > draw a line between them by clicking with
>> mouse. I
>> > > > have stored the centre of bounds of two
>> objects
>> > > > using setUserData() method. I am also able to
>> > > pick
>> > > > the objects on the screen using pick methods.
>> > > >
>> > > > The only problem that is coming is that
>> > > getUserData is
>> > > > returning null, which I don't know why. I
>> might be
>> > > > making some silly mistake but i don't have any
>> > > idea
>> > > > about it. I am working on this code for last
>> four
>> > > > days and have tried different things. I am
>> > > attaching
>> > > > the entire code as well as getUserData part.
>> > > >
>> > > > Since cg[] is null, i am getting null pointer
>> > > > exception.
>> > > >
>> > > > if ( myShape!=null)
>> > > > {
>> > > > cg[count++] = (Point3d)myShape.getUserData();
>> > > > System.out.println(cg[count]);//returning null
>> > > > LineArray la=new
>> > > > LineArray(count,LineArray.COORDINATES);
>> > > > la.setCoordinates(0,cg);
>> > > > }
>> > > >
>> > > > Please tell me.
>> > > >
>> > > > Thanks
>> > > >
>> > > >
>> __________________________________________________
>> > > > Do You Yahoo!?
>> > > > Get personalized email addresses from Yahoo!
>> Mail
>> > > > http://personal.mail.yahoo.com/
>> > > >
>> > > >
>> > >
>> >
>>
>------------------------------------------------------------------------
>> > > > Name: SimpleLine.java
>> > > > SimpleLine.java Type: JavaScript
>> Program
>> > > (application/x-javascript)
>> > > > Encoding: base64
>> > > > Description: SimpleLine.java
>> > >
>> > >
>> >
>>
>===========================================================================
>> > > 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".
>> >
>> > =====
>> > Graduate Research Assistant
>> > Virtual/Augmented and Rapid Prototyping Lab
>> > University of Missouri-Rolla
>> > Rolla, MO 65401
>> > 573-341-6815 (O)/573-308-1380 (R)
>> > FAX: 573-341-6815
>> >
>> > __________________________________________________
>> > Do You Yahoo!?
>> > Get personalized email addresses from Yahoo! Mail
>> > http://personal.mail.yahoo.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".
>
>
>=====
>Graduate Research Assistant
>Virtual/Augmented and Rapid Prototyping Lab
>University of Missouri-Rolla
>Rolla, MO 65401
>573-341-6815 (O)/573-308-1380 (R)
>FAX: 573-341-6815
>
>__________________________________________________
>Do You Yahoo!?
>Get personalized email addresses from Yahoo! Mail
>http://personal.mail.yahoo.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".