Skip to main content
gamedev.net
🔒 Locked

[java] Rotations in the Transform3D Class..

Started by ArchangelMorph Apr 8, 2005 at 12:14 PM 1 replies 750+ views
Original Post
ArchangelMorph
ArchangelMorph
Hi just a question.. I want to rotate a 3D object by a certain degree (lets say 30 degrees about Y).. I figured I could use the setEuler() method and specify the Y rotation to the specific value but I'm not sure how I would assign the value exactly.. Does the method deal with rotations in radians or in degrees and if I wanted to specify the rotation as float's rather than double's then is that also possible? Also is there a Java3D method to convert degrees to radians? Hope someone can help..
CthulhuLives
CthulhuLives
//create your geometryTransform3D trSun = new Transform3D();BufferedReader brSun = new BufferedReader(new FileReader("sol.ASE"));TransformGroup sun = new TransformGroup(); AseReader rSun = new AseReader(brSun); afSun.parse(rSun);sun.addChild(afSun.getModel());...add to your scene...and other stuffthen to do a rotate                sun.getTransform(trSun);          trSun.rotY(spinSun);          sun.setTransform(trSun);


the rotY is expressed in radians counterclockwise around the y axis. if you want to use a float I'm guessing you'll have to change overload the rotY command with your own code and recompile.
Cthulhu
chris_j_pook
chris_j_pook
You can convert degrees to radians using this ...

rads = (degs * (Math.PI/180));

Its not 100% accurate but pretty close.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.