NecroDOME
28-11-2006, 04:09 PM
Hi,
case CameraType of
cameraFree:
begin
D3DXQuaternionRotationYawPitchRoll(Quat, Rotation.x + CameraShake.Rotation.x,
Rotation.y + CameraShake.Rotation.y,
Rotation.z + CameraShake.Rotation.z);
D3DXMatrixRotationQuaternion( matRot, Quat );
D3DXMatrixTranslation(matPos, Position.X, Position.Y, Position.Z);
D3DXMatrixMultiply(matView, matRot, matPos);
D3DXMatrixInverse( matView, nil, matView );
Screen.Device.SetTransform(D3DTS_VIEW, matView);
end;
cameraTarget:
begin
D3DXMatrixLookAtLH(matView, Position, TargetPoint, WolrdUp);
Screen.Device.SetTransform( D3DTS_VIEW, matView );
// Somewhere here: Rotation := GetRot(matView );
end;
end;
This piece of code I use to setup my camera in 3D view. However when I have a cameraTarget, I want to be able to retrieve teh rotation. How can I get the rotation from matView???
I realy need it. I use it to rotate the particles :P
Greets Michiel
case CameraType of
cameraFree:
begin
D3DXQuaternionRotationYawPitchRoll(Quat, Rotation.x + CameraShake.Rotation.x,
Rotation.y + CameraShake.Rotation.y,
Rotation.z + CameraShake.Rotation.z);
D3DXMatrixRotationQuaternion( matRot, Quat );
D3DXMatrixTranslation(matPos, Position.X, Position.Y, Position.Z);
D3DXMatrixMultiply(matView, matRot, matPos);
D3DXMatrixInverse( matView, nil, matView );
Screen.Device.SetTransform(D3DTS_VIEW, matView);
end;
cameraTarget:
begin
D3DXMatrixLookAtLH(matView, Position, TargetPoint, WolrdUp);
Screen.Device.SetTransform( D3DTS_VIEW, matView );
// Somewhere here: Rotation := GetRot(matView );
end;
end;
This piece of code I use to setup my camera in 3D view. However when I have a cameraTarget, I want to be able to retrieve teh rotation. How can I get the rotation from matView???
I realy need it. I use it to rotate the particles :P
Greets Michiel