Hello

Hello,

Can someone explain me why this is possible ?
https://www.youtube.com/watch?v=bjflkb1GzaM

If you apply the rotations on a cube for instance (or it's parent dummy), it will turn around X axis, then Y axis and finaly Z. So if X and Y are not null, Z will not turn on the depth axis anymore but around a rotated axis.

Why a Camera in a rotating Dummy still rotates along the desired axis ?!

Under OpenGL I use a Matrix to cumulate the rotations and add the new one, but I can not reset the component with a null rotation, I have to clear the matrix...I miss something

Thanks

https://www.youtube.com/watch?v=bjflkb1GzaM

Comments

  1. I don't know if I get the problem right...
    But in the past I also had a lot of problems with the rotation and in general with the build of the AbsoluteMatrix of a 3D object.

    Because FMX uses redundant fields to store information about rotation, scale and translation. Maybe you're updating not all necessary fields.
    There are protected fields "FQuaternion" and "FLocalMatrix" and public properties "Position", "RotationAngle" and "Scale", which all are used in combination to build the absolute matrix.

    Applying a transformation matrix needs special treatment.
    Something like this:

    TControl3DHelper = class helper for TControl3D
    public
    procedure SetAbsoluteTransformation(const AMatrix : TMatrix3D);
    end;

    procedure TControl3DHelper.SetAbsoluteTransformation(const AMatrix : TMatrix3D);
    begin
    // apply position from matrix
    Self.Position.SetPoint3DNoChange(AMatrix.M[3]);

    // apply scaling from matrix
    Self.Scale.SetPoint3DNoChange(GetScalingFromMatrix(AMatrix));

    // get euler angles from rotation matrix
    // and apply them to rotation property
    RotationAngle.SetPoint3DNoChange(GetEulerAnglesFromMatrix(AMatrix));

    FSavedRotationAngle := Point3D(0, 0, 0);
    FQuaternion := TQuaternion3D.Create(AMatrix);
    FLocalMatrix := AMatrix;

    Self.RecalcAbsolute();
    RebuildRenderingList;
    Repaint;
    end;

    ReplyDelete
  2. Eric Berger I know that :)

    https://github.com/tothpaul/Delphi/blob/master/Google%20Cardboard/lib/Execute.StereoViewPort.pas#L178

    That's why I'm so surprise that the camera rotate around the screen axes instead of rotated one

    ReplyDelete

Post a Comment