5471

Rotate around a specific point in Java3D

Question:

I'm importing 2 models in Java3D, scaling them down and then rotating one of them using a RotationInterpolator

However, this rotates the object around the origin. I want to rotate the object around ITS centre, not the scene's. Put simply, I want it to spin in place.

How do I rotate around a specific point?

TransformGroup rotateTheBlades = new TransformGroup(); rotateTheBlades.setCapability( TransformGroup.ALLOW_TRANSFORM_WRITE); Alpha rotationAlpha = new Alpha(-1,5000); RotationInterpolator rotator = new RotationInterpolator( rotationAlpha,rotateTheBlades); Transform3D abc = new Transform3D(); abc.rotZ(Math.PI/2); rotator.setTransformAxis(abc); rotator.setSchedulingBounds(new BoundingSphere()); rotateTheBlades.addChild(rotator); rotateTheBlades.addChild(theBlades);

This is my code for doing my current rotation.

Answer1:

DR answered with translating the object to the origin, performing the rotation, then translating the object back to its position. Which worked.

My actual solution was to simply centre the model at the origin in the .obj file I was loading into Java3D, perform my rotation, and then translate the objects to their proper position.

Recommend

  • how to replace the hardcoded values from data provider
  • How are WPF Buttons and TextBlock styles related?
  • How to create appium TestSuite in Android Studio
  • Button Rendering Incorrectly after Rotation Transformation within a Silverlight Control
  • Invalid capabilities in alwaysMatch: unhandledPromptBehavior is type boolean instead of string
  • IELaunchURL issue with Selenium IE Driver
  • How do I add arguments to ChromeDriver while also using mobile emulation (Java)?
  • How to setAcceptUntrustedCertificates for Safari.
  • How to set Proxy Authentication in seleniumWebdriver for Chrome Browser
  • How to enable PhantomJS WebDriver in Selenium?
  • Using a proxy server with Laravel Dusk
  • How to test multiple version of google chrome using chromedriver?
  • Getting error 'xargs' is not recognized as an internal or external command. While running
  • Select one option from many options in drop down list in Eclipse using java when run code for the an
  • Selenium WebDriver on IE 9, on clicking, links are flashing as if some click event was not completel
  • Creating Firefox profile and switching off the marionette
  • Rotate around a specific point in Java3D
  • Exception in thread “main” org.openqa.selenium.remote.UnreachableBrowserException: Could not start a
  • Docker + Laravel queue:work
  • Traditional (standard) checkout (step by step page)
  • Deadlock clarification?
  • How to enable and use WebView for iOS Automation in Appium
  • How to change EasingDoubleKeyFrame value at Runtime?
  • Jenkins Build Error: Build step 'Invoke top-level Maven targets' marked build as failure
  • Start a shell process in Gulp with callback when process started
  • change search magnifying glass to UIActivityIndicatorView
  • What does 'Language neutral' mean with regard to MAKELANGID?
  • Excel's Macro-Recorder usage
  • How to use carriage return with multiple line?
  • Highlight one bar in a series in highcharts?
  • Android screen density dpi vs ppi
  • How would I use PHP exceptions to define a redirect?
  • How to extract text from Word files using C#?
  • Weird JavaScript statement, what does it mean?
  • Matrix multiplication with MKL
  • CSS Applying specific rule for a specific monitor resolution with only CSS is posible?
  • What are the advantages and disadvantages of reading an entire file into a single String as opposed
  • need help with bizarre java.net.HttpURLConnection behavior
  • Converting MP3 duration time