PDA

View Full Version : Syncronized rotation problem



KDenisK
28-10-2006, 07:02 PM
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;

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

Brainer
04-11-2006, 07:45 AM
Hey :D

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


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;


HTH,
Br@iner.[/pascal]

KDenisK
04-11-2006, 08:30 AM
Couldn't see any changes in my code.

Brainer
04-11-2006, 09:40 AM
Couldn't see any changes in my code.

Hehe :lol:

Compare them better :)

JernejL
04-11-2006, 10:54 AM
Couldn't see any changes in my code.

he replaced you GLDummyCube1 with GLCamera1.