Roy Holmes
Resource contributor
- Messages
- 1,805
- Country

The problem seems to be that the range of movement is only the +/- 5 degrees in the code. The pan and tilt positions are not being updated
To check it out I made a small gauge and got it to move a box representing camera position to the mouse position in 5 degree steps. When it gets there it stays there until the mouse is moved to another position.
It also has Tilt and Pan readouts.
Here is the code:
At the top is an init section that sets the Tilt and Pan position in the center of the 120 by 120 image (Image is attached)
Then you have the numeric readouts and polyline box.
The mouse code compares the current pan value (L:camera_panPos, number)to where the mouse is (M:X) and if the pan value is less it stores 5 in "pandelta", els it stores -5 . The current pan value is added to pandelta and used to update (L:camera_panPos, number).
The tilt logic is the same.
Not tried it in modeldef, but it should help
Roy
To check it out I made a small gauge and got it to move a box representing camera position to the mouse position in 5 degree steps. When it gets there it stays there until the mouse is moved to another position.
It also has Tilt and Pan readouts.
Here is the code:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<Gauge Name="CameraLogic">
<Image Name="TurretInput.bmp" Bright="Yes"/>
<Element>
<Select>
<Value>(L:init_TiltPan,bool) 0 == if{ 50 (>L:camera_TiltPos, number) 50 (>L:camera_PanPos, number) (L:init_TiltPan,bool) ! (>L:init_TiltPan,bool)</Value>
</Select>
</Element>
<Element>
<Position X="10" Y="10"/>
<Text X="90" Y="15" Bright="Yes" Length="9" Font="Arial" Color="#FFFFFF" Adjust="Center" VerticalAdjust="Center" Multiline="No">
<String>Tilt %((L:camera_TiltPos, number))%!3d!</String>
</Text>
</Element>
<Element>
<Position X="10" Y="25"/>
<Text X="90" Y="15" Bright="Yes" Length="11" Font="Arial" Color="#FFFFFF" Adjust="Center" VerticalAdjust="Center" Multiline="No">
<String>Pan %((L:camera_panPos, number))%!3d!</String>
</Text>
</Element>
<Element>
<Position X="10" Y="10"/>
<Polyline Color="White" LineWidth="2">
<Point X="-5" Y="5"/>
<Point X="5" Y="5"/>
<Point X="5" Y="-5"/>
<Point X="-5" Y="-5"/>
<Point X="-5" Y="5"/>
</Polyline>
<Shift>
<Value>(L:camera_TiltPos, number)</Value>
<Scale X="0" Y="1"/>
</Shift>
<Shift>
<Value>(L:camera_PanPos, number)</Value>
<Scale X="1" Y="0"/>
</Shift>
</Element>
<Mouse>
<Area Left="10" Top="10" Width="100" Height="100">
<Tooltip>Camera Pan/Tilt</Tooltip>
<Cursor Type="Hand"/>
<Click>
(L:camera_panPos, number) (M:X) < if{ 5 + } els{ 5 - } (>L:camera_pandelta, number) (L:camera_pandelta, number) (L:camera_panPos, number) + (>L:camera_panPos, number)
(L:camera_TiltPos, number) (M:Y) < if{ 5 + } els{ 5 - } (>L:camera_tiltdelta, number) (L:camera_tiltdelta, number) (L:camera_TiltPos, number) + (>L:camera_TiltPos, number)
</Click>
</Area>
</Mouse>
</Gauge>
At the top is an init section that sets the Tilt and Pan position in the center of the 120 by 120 image (Image is attached)
Then you have the numeric readouts and polyline box.
The mouse code compares the current pan value (L:camera_panPos, number)to where the mouse is (M:X) and if the pan value is less it stores 5 in "pandelta", els it stores -5 . The current pan value is added to pandelta and used to update (L:camera_panPos, number).
The tilt logic is the same.
Not tried it in modeldef, but it should help
Roy



