unit RotationScript;

interface

uses
  _Geometry,
  Frost.Engine;

type
TRotateObject = class(TComponent)
  private
    FRotation: TMatrix3;
  public
    procedure OnStart; override;
    procedure OnUpdate(const Delta: Double); override;
  end;

implementation

{$REGION 'Rotate Object'}
procedure TRotateObject.OnStart;
begin
  FRotation := Rotate(Random(6) - 3, Vector3(0, 1, 0));
end;

procedure TRotateObject.OnUpdate(const Delta: Double);
begin
  gameObject.LocalRotation := gameObject.LocalRotation * FRotation;
end;
{$ENDREGION}
end.
