Rotate around disk Origin

I have a disk in scene i want to rotate it around its own center how i do it? :sweat_smile:

With math.

For more help than that, you will have to show us the code that you are using that doesn’t work.

this is the scene actually code is in RotateControl and in controlUpdate method
I just used single line spatial.rotate(1*tpf,0,0);
I could use anim for it, but since frisbee gonna move on air i want to have it manually so i later code it to make speed of rotation relative to speed of frisbee that moving on air.

I want that the disk rotate around Origin of it self.

It’s still hard to tell what’s going on from this line alone because your spatial variable here could be storing a reference to the Geometry for the frisbee, or it could be storing a reference to a parent Node that the frisbee Geometry is attached to and offset from the origin of.

In your case, based on the diagram you shared in your original post, it sounds like your frisbee geometry has been moved away from the origin of a parent node that is being rotated.

To get the frisbee rotating the way you want, you should attach your frisbee to a Node, then position the frisbee geometry so that the center of your frisbee is located at the origin point of the parent node. Then when you rotate the parent node, the frisbee will be properly rotating around its central point.

No Actually i didn’t used any node it’s directly attached to rootNode
code from appstate

protected void onEnable() {

        app = (SimpleApplication) getApplication();
        rootNode = app.getRootNode();

        frisebee = getApplication().getAssetManager().loadModel("Models/freezbeez/yellowish.glb");
        Node probeNode = (Node) getApplication().getAssetManager().loadModel("Scenes/defaultProbe.j3o");
        LightProbe probe = (LightProbe) probeNode.getLocalLightList().iterator().next();


        CameraControl cameraControl = new CameraControl(getApplication().getCamera(), app.getInputManager());

        Spatial torus = getApplication().getAssetManager().loadModel("Models/torus/untitled.glb");

        dl = new DirectionalLight();
        dl.setDirection(new Vector3f(-1, -1, -1).normalizeLocal());

        SpatialRotate spatialRotate = new SpatialRotate();

        Spatial sky = SkyFactory.createSky(app.getAssetManager(), "Textures/Sky/4kresovled.hdr", SkyFactory.EnvMapType.EquirectMap);

codefrom camcontrol

 private final float cTransX = 0.2f;
    private final float cTransY = 0.3f;
    private final float cTransZ = 1.3f;
    private final float cRotateX = 0.2f;
//inside control update related to SpatialToCamera
 cRotate = spatial.getLocalRotation();
        cTransForm = spatial.getLocalTranslation();

        if (spatial != null && camera != null) {
            switch (controlDir) {
                case SpatialToCamera:
                    camera.setLocation(new Vector3f(cTransForm.x -cTransX
                            , cTransForm.y+cTransY,
                            cTransForm.z - cTransZ));
                    camera.setRotation(new Quaternion( cRotateX,0,0,0));


protected void controlUpdate(float tpf){
        if(spatial != null) {


It is still possible that the glb file for the frisbee has the Geometry nested under 1 or more parent nodes, and that could be where the offset is coming from.

Are you using the SDK that you’re able to convert your model to .j3o and view it in the scene composer? If so then you should be able to easily inspect it and fix the position of the frisbee geometry if necessary.

1 Like

Else, my answer stands. Math.

Or, I’m holding a piece of red fuzzy string. It’s thick and quite fuzzy. Can you tell me how long it is?

bro i don’t get you well what do you mean?

Asking someone to debug your code without actually showing your code is just like asking someone else to guess the length of a piece of string that you hold in your hand.

Right now, only you have the information to solve your problem. If you want us to help you solve your problem then you will have to also give US that information.

Otherwise, you are just asking us how long your piece of string is.

thank you, you are right problem is inside the glb i didn’t apply rotation to it so rotation of the geometry is in the glb file. I fixed it, applied it to origin.

1 Like

I see your mean now. Sorry pspeed next times I gonna add all the info needed.