Rotation from other point not from origin

Hello, I have a GLF file, It’s a industrial robot, as you can see. When I try to rotate the axis 2, this Transforms rotates from origin.
I want to rotate from the “original” rotation point of this axis. How can I do it?.
I upload some image that may explains better than me.
Captura de pantalla 2024-04-22 162957
Captura de pantalla 2024-04-22 162957

I use this code to rotate:
if Event.IsKey(keyZ) then
begin
Q1 := QuatFromAxisAngle(Vector3(1.0, 0.0, 0.0), 0);
Q2 := QuatFromAxisAngle(Vector3(0.0, 1.0, 0.0), 0);
Q3 := QuatFromAxisAngle(Vector3(0.0, 0.0, 1.0), 1);
QFinal := Q3 * Q2 * Q1;
AnguloFinal := QFinal.ToAxisAngle;
eje2.Rotation := AnguloFinal;
Exit(true);
end;
Unnamed-IRB6740_240kg-320_OC_00_ASM_CAD.gltf (3.5 MB)
Also I upload the GLF file
Any idea?
B.R.
/blueIcaro

Hello, I found a solution. I modified the centre and move to a correct position. As I know the coordinates, I wrote:
(…)
private
Eje2: TTransformNode;
(…)
Eje2 := robot.Node(‘IRB6740_240kg-320_OC_00_LINK02_CAD’) as TTransformNode;
Eje2.Center := Vector3(0.320, 0.780, 0);

/BlueIcaro

2 Likes

Sorry for delay, but I see you solved it :slight_smile:

Just to confirm: Yes, when the “origin” of your transformation is not the best point around which to rotate, then setting Center is exactly the solution.

There is TTransformNode.Center, there’s also TCastleTransform.Center, that work the same – it is the center point around which rotations and scaling are performed. By default it is just (0,0,0) so rotations / scaling are performed around the zero point of the appropriate transformation. See

the best point around which to rotate, then setting Center is exactly the solution.

Hello. Thanks for the explanation, I found the solution but I was not be sure that I doing in a right way.

/BlueIcaro