Title: Message
To be honest, there's not enough to go on here. Forget for a minute the fact you're doing this in Java3D, or on a computer, and get some pencil and paper out.  All it will come down to is working out the distance and the angle between your object's pointing direction, and the wall, and then use sin(theta) = opposite/hypotenuse, cos(theta) = adjacent/hypotenuse and wot-not. This will enable you to get the coordinates of the sphere impact point, in the two axes of the 2D wall surface, and hence display it at the right position.
 
I can do the math for you if it's a problem, but not without a diagram of your setup, along with the global and relative coordinate axes for your objects.
 
Lewis.
-----Original Message-----
From: Discussion list for Java 3D API [mailto:[EMAIL PROTECTED] On Behalf Of Richard Bone
Sent: 01 September 2003 16:40
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Getting the rotation value

Ok.  I’ve looked around the web to find out how to do this but it never seems to work properly.

What I want to do is point an object at a wall and create a sphere on the wall where it hits.  This I can do but if I rotate the object, the value I get bears no resemblance to the amount the object has rotated.  Here is the code snippet:

 

tempTrans2.get(currentRot);

currentRot.get(rotValues);

 

cosAngle  = rotValues[3];

                        angle     = Math.toDegrees(Math.acos( cosAngle ) * 2);

                        sinAngle  = Math.sqrt( 1.0 - cosAngle * cosAngle );

                        if ( Math.abs( sinAngle ) < 0.0005d )

                                    sinAngle = 1.0d;

 

                        rotX = (float)(rotValues[0] / sinAngle) * (float)angle;

This is based on the info I found on the web.

This is due for demonstration at university (as part of a larger project) on Friday so please feel free to respond quickly!

Cheers

Rich Bone

Birmingham University, UK

=========================================================================== 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".

Reply via email to