Results 1 to 5 of 5

Thread: Syncronized rotation problem

  1. #1

    Syncronized rotation problem

    [pascal]procedure TForm1.glSceneViewerMouseMove(Sender: TObject; Shift: TShiftState; X,
    Y: Integer);
    const
    koef = 0.5;
    begin
    if Shift<>[] then begin
    if ssLeft in Shift then
    begin
    GLCamera1.MoveAroundTarget((my - y) * koef, (mx - x) * koef);
    GLLightSource1.MoveObjectAround(
    GLDummyCube1, (my - y) * koef, (mx - x) * koef);
    GLLightSource2.MoveObjectAround(
    GLDummyCube1, (my - y) * koef, (mx - x) * koef);
    end
    else
    GLCamera1.RotateTarget(my - y, mx - x);
    mx := x;
    my := y;
    end;
    end;[/pascal]

    Ive used this code to rotate Camera and LightSources in the same way. But only camera was rotated. What could be the problem?

  2. #2

    Re: Syncronized rotation problem

    Hey

    I didn't try to make it work, but try to make this:

    [pascal]
    procedure TForm1.glSceneViewerMouseMove(Sender: TObject; Shift: TShiftState; X,
    Y: Integer);
    const
    koef = 0.5;
    begin
    if Shift<>[] then begin
    if ssLeft in Shift then
    begin
    GLCamera1.MoveAroundTarget((my - y) * koef, (mx - x) * koef);
    GLLightSource1.MoveObjectAround(
    GLCamera1, (my - y) * koef, (mx - x) * koef);
    GLLightSource2.MoveObjectAround(
    GLCamera1, (my - y) * koef, (mx - x) * koef);
    end
    else
    GLCamera1.RotateTarget(my - y, mx - x);
    mx := x;
    my := y;
    end;
    end;
    [/pascal]

    HTH,
    Br@iner.[/pascal]

  3. #3

    Syncronized rotation problem

    Couldn't see any changes in my code.

  4. #4

    Syncronized rotation problem

    Quote Originally Posted by KDenisK
    Couldn't see any changes in my code.
    Hehe :lol:

    Compare them better

  5. #5

    Syncronized rotation problem

    Quote Originally Posted by KDenisK
    Couldn't see any changes in my code.
    he replaced you GLDummyCube1 with GLCamera1.
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •