How do I choose constraints/pivots to make this cylinder rotating? - Blender



I have model this and how I want to set some pivots/constraints so it won’t fall down when I rotate the shaft. Can you give me some advise which constaints/pivots I should use?

My goal is to load this model into jMonkey and simulate it when it rotates.
Then I need to set a force to end of the shaft and measurement at the other end. I don’t know how to do that, so I would be very glad if you could show me some advise/tutorials how to do that. Do I need to specify the inertia, mass, radius, friction inside jMonkey or should I do that inside Blender?


My total goal is to build a adaptive controller who rotates this cylinder in a desired velocity. But the controller needs to learn the damping, stiffness and inertia, which the adaptive controller computes by simply rotate the cylinder up and down and up and down for a while, then tune in the controller with perfect parameters.


To answer the part of your question about rotating, you may find the information in this Node tutorial useful, specifically using a Node as a “pivotNode” to rotate objects around a specific point.

But when it comes to the more advanced physics aspects you mentioned like intertia and damping, you would have to account for that on your own if you rotate using a simple Node.

Alternatively, you could try to use the Bullet physics library ( to do physically accurate rotations, although I never tried this in a case like yours, so hopefully someone with more experience could offer some input. I did find this thread in a quick search that may be useful if you go that route Rotating rigidbody object



Do I really need to set the pivots/constraints with java code? Isn’t that another way to do that? Blender?


I am not sure if there’s a way to do so in blender - the blender exporters I have experience with are the ogre exporter and gltf exporter, and unless I’m erong neither offer any way to do this that I’m aware of.

But the node tutorial I linked should have all the code youd need. Just attach your object to a pivot node, and call its rotate method in the update loop.


My guess is that you should import a model that has a specific job and code it in. And then join the parts as you know best. You will need to code yes. But that’s how it works, unfortunately. You can apply rotational impulses or directional and also use joints. It’s not that easy. It requires a lot of reading and understanding on your part here…


Attach a pivot node inside Blender, export it with ORGE and then use java to rotate the object?


Yes. But I’m not sure where to start. The code, manuals etc have like thousands of explanations how to do this.

Or is it better to not use Blender at all, and only modeling the primitives with code instead? I’m not going to model real graphics in level of Unreal. I only want to use java to simulate dynamics for scientific research.


If you use the ogre exporter, then your object will actually be nested within multiple nodes by default (you can see this if you open it in the SDK scene composer), and you could use one of those nodes the pivot node, specifically the one containing your cylindircal object that is going to spin, so yes to your question - you’d still have to do a small amount of code in your JME app to reference the correct pivot node, and then also call the rotate method in the update loop.

This is also the simple, less physically accurate way of doing it. But it may work for you depending on how accurate the simulation needs to be. But I’d imagine as long as the rotation slows down and speeds up at a realistic rate, then it could look just as realistic.

The code would most likely look like this. If you can get something like this to start working, then you should most likely be able to figure out what’s going on and tweak things to your needs.

  private Spatial cylindricalObjectThatSpins;
  private float spinSpeed = 5;

 public void simpleInitApp() {
   Node blenderModel = assetManager.loadModel("Models/yourModle.j3o");
   cylindricalObjectThatSpins = blenderMode.getChild("nameOfSpinnyObject");
                                                 // *you can find the child's name in the SDK scene composer
   public void simpleUpdate(float tpf) {
        cylindricalObjectThatSpins.rotate(tpf * spinSpeed , 0, 0);



Thank you for your answers! I think that I need to jump back to java code and let Blender rest for a while.


Use an animation.

You can learn about rotations from the pdf by neal Hirsig on the Rocket Steam Locomotive.

Unfortunately, the site for Neal is no longer active and the archive link is nowhere to be found.

Thankfully for me, I downloaded all the pdfs to my computer before it went poof but you can find remnants still on the net, as you can see by the links above.

Use this to find other pdfs.

See pdfs 11c, 12b, 12c.

for more videos

You can try to manipulate the speed of the animation but as for the formula to do that, I wouldn’t have a clue,

The locomotive has a speed formula for the rotations in it but how to tie it to jme anim speed is probably doable but may not be realistic. haven’t tried.


Just a quick question!

Can update() method in JME read text file? I going to make so update() read coordinates for a mass on a spring.


Yes, it’s certainly possible, but it’ll kill your framerate. The update() method is called once per frame to update spatials’ logical state, so doing things like IO are generally a very bad idea.


Yep, you should use another thread for this. And if that needs to affect the visuals, like I assume now with the keyword “coordinates”, you need to pass it to the render thread via enqueue() method.