Jump to content
The simFlight Network Forums

Panning and Zooming Assignments


Wallboy
 Share

Recommended Posts

Hello, I'm using FSUIPC to program all my axes/buttons instead of FSXs control menu. I'm using a PS3 controller to fly as it's all I have, but suits by needs. I have 2 questions regarding panning and zooming. I have everything setup and calibrated without any troubles, but want to make a few adjustments that I'm not sure how to go about doing.

 

First is I have my right analog stick setup as panning for Pitch and Heading axis. However, I was wondering if I can keep the view from resetting to center when i let go of the stick. I'd like the panned view to stay where it's at when I pitch/heading pan in some direction. Pretty much the same thing when you hold spacebar and move the mouse the view stays where it's at after moving. 

 

My second question is I want to setup my analog triggers to be zoom in and out, but have a limit to the maximum zoom in and out position as I believe I tried View Zoom Set and it seemed to work, however the values it used to zoom were way to sensitive and high to be useful. I would like something like full left trigger to zoom out to a maximum of 0.40 and the right trigger to zoom in to a maximum of around 1.00. 

 

Thanks.

Link to comment
Share on other sites

  • 2 weeks later...
First is I have my right analog stick setup as panning for Pitch and Heading axis. However, I was wondering if I can keep the view from resetting to center when i let go of the stick.

 

Well, the problem if you are programming these as an axis is that the stick is sending the changes when it returns to the centre. If you stop those changes doing anything, how can you then change the view in the other direction? It is a logical impossibility.  I recommend you either program chosen positions on the stick to send the discrete "pan left", pan right" etc controls instead of the axis controls (you can do this on the RIGHT-HAND SIDE of the axis assignments tab, don't use the left), OR simply remove the springs or whatever from the joystick so it stays where yo put it. You may need to stiffent it a bit to stop it moving about.

 

My second question is I want to setup my analog triggers to be zoom in and out, but have a limit to the maximum zoom in and out position as I believe I tried View Zoom Set and it seemed to work, however the values it used to zoom were way to sensitive and high to be useful. I would like something like full left trigger to zoom out to a maximum of 0.40 and the right trigger to zoom in to a maximum of around 1.00.

 

 

I don't know what "analog triggers" are -- are they more joystick axes or just buttons? If buttons than you could program them to write to the FSUIPC offset for zoom (x2b2). Use the assignment Offset Word Inc or Dec. In that offset 64 represents x1, 128 x2 etc, so incrementing /decrementing by 1 gives you 1/64ths. For axes you could probably do the same and use the axis assignment multiplier/adder facilities 9editing the INI file) to limit that values sent.

 

With the button assignment method, if you want to apply a non-zero lower limit you'd need to think about a Lua plug-in to program it instead.

 

Pete

Link to comment
Share on other sites

Yeah I guess what I want for my camera is not axis based, but I was hoping that I could set it up such that if I say hold the stick to the left it would pan smoothly to the left and the less distance the stick is held, the slower it would pan, whereas holding the stick fully one way, it would pan fast. And when I let go (axis zeros) it would freeze at that current camera position. I tried your method of using the right hand side of axis assignments and it works, but it pans in increments and not smoothly. I have control to repeat checked as well.

 

The triggers act just like rudder pedals, they are an axis. I guess I'm trying to set up almost the same ideas as my camera. If I hold the left pedal in just a small ways, the camera zooms out slowly. And the more I press it the faster it zooms out. And when at zero, keeps the current zoom level. Same thing for the right pedal, just zooming in. And I would like to set a min/max zoom that it could do. Mostly max zoom as that's the one I'm having a problem with zooming to far. 

Link to comment
Share on other sites

Yeah I guess what I want for my camera is not axis based, but I was hoping that I could set it up such that if I say hold the stick to the left it would pan smoothly to the left and the less distance the stick is held, the slower it would pan, whereas holding the stick fully one way, it would pan fast. And when I let go (axis zeros) it would freeze at that current camera position.

 

I tried your method of using the right hand side of axis assignments and it works, but it pans in increments and not smoothly. I have control to repeat checked as well.

 

The triggers act just like rudder pedals, they are an axis. I guess I'm trying to set up almost the same ideas as my camera. If I hold the left pedal in just a small ways, the camera zooms out slowly. And the more I press it the faster it zooms out. And when at zero, keeps the current zoom level. Same thing for the right pedal, just zooming in. And I would like to set a min/max zoom that it could do. Mostly max zoom as that's the one I'm having a problem with zooming to far. 

 

Hmm. Axes don't work quite like that. However, you could do that with a Lua plug-in, allowing axis values through when increasing from 0 or decreasing from 0 but not when returning to 0. It would be quite easy. Have a look at the Lua facilities. if it looks too complicated let me know and i'll knock something together. I've got to go out now so it'll be a while.

 

Max zooms can be handled by a max on the increment.

 

Regards

Pete

Link to comment
Share on other sites

Alright I'll take a look at the LUA facilities. I didn't see an option for increment max/min. I'm guessing it's maybe in the .ini? 

 

The max I referred to was for the Offset word inc and Offset word dec controls. Nothing to do with a Lua solution for the axis control of panning. I'll post an idea for the latter later.

 

Pete

Link to comment
Share on other sites

I'll post an idea for the latter later.

 

 

Okay. Here it is, but I don't think you'll like it too much as there's so much code interpretation to be done that it may be too jerky for you:

-- put calibration values here
max = 16380
topcentre = 512
bottomcentre = -512
min = -16380
 
prev = 0
absprev = 0

function panning(val)

   -- Delete from here if calibration not needed
   if val > topcentre then
           val = ((val - topcentre) * 16383) / (max - topcentre)
   elseif val < bottomcentre then
           val = (((val - min) * 16383) / (bottomcentre - min)) - 16383
   else val = 0 end
   -- End part to be optionally deleted

   if val == 0 then return end
   sendit = false
   absval = val
   if val < 0 then absval = -val end
   if absval < absprev then
      if (val < 0 and prev > 0) or
         (val > 0 and prev < 0) then
             sendthis = prev + val
             sendit = true
      end
   else
      sendthis = val
      sendit = true
   end
   if sendit then
      ipc.control(66504, sendthis) --Axis pan heading (use Axis Pan Pitch for other axis)
      prev = val
      absprev = absval
   end
end

event.param("panning")

This is for heading pan. Note that because the sending of axis controls from Lua bypasses FSUIPC calibration you need to calibrate IN FSUIPC first, then put the 4 values you get into those top 4 lines, as shown (those are just defaults). If you don't do this it'll be very wonky! Then reset the FSUIPC calibration so it does nothing.

 

NB if your axes are perfect -- i.e. max = 16384 and min = -16384, or close, and centre is ALWAYS 0, then delete the  calibration part above and the line calling it. That might then just make it smooth enough, though I still have doubts.

 

The pitch one would be the same but with the Axis an Pitch control number in the ipc.control you see.

 

You'd need to save this as, say, panhdg.lua, into the Modules folder, similarly the pitch one, say as panpch.lua. Add

 

[Auto]

1=Lua panhdg

2=Lua panpch

 

to the FSUIPC INI file, the rerun FS and assign the heading axis to Luavalue panhdg and the pitch axis to Luavalue panpch.

 

Personally I think you might want to consider getting a normal hat control.

 

Regards

Pete

Link to comment
Share on other sites

Alright I have these set up and running and it's exactly what I want, and feels quite smooth. The only problem I'm having now is it's panning/pitching too fast for the amount I move the stick. Is there any setting I can control the sensitivity of it? 

 

Thanks again, definitely something I probably wouldn't have figured out on my own.

Link to comment
Share on other sites

Alright I have these set up and running and it's exactly what I want, and feels quite smooth. The only problem I'm having now is it's panning/pitching too fast for the amount I move the stick. Is there any setting I can control the sensitivity of it?

 

If you need to reach both extremes of the panning then you really do have to use the numbers as they aree (calibrated to -16383 and +16383, the extremes).

 

If you are happy having less angle You have two ways to do that.  Either divide the final "sendthis" value being sent by some number, eg. 2 would halve the angle and the sensitivity, thus:

 

ipc.control(..., sendthis/2)

 

Or add the divisor into the FSUIPC INI axis assignment (adding ,*0.5 at the end).  However this way might mess the calibration numbers up (if you are having the Lua plug-in calibrating).

 

In FSUIPC calibration you get less sensitivity in the centre parts without satisfying the angle by flattening the curve, but to do that in the Lua would require a bunch of new code and slow it down more.

 

After I posted the solution above I did think of another way to do this, using PAN VIEW, just like a Hat. Here:

max = 16380
topcentre = 512
bottomcentre = -512
min = -16380
 
prev = 0
absprev = 0

function panning(val)

   if val > topcentre then
           val = ((val - topcentre) * 16383) / (max - topcentre)
   elseif val < bottomcentre then
           val = (((val - min) * 16383) / (bottomcentre - min)) - 16383
   else val = 0 end

   if val == 0 then return end
   sendit = false
   absval = val
   if val < 0 then absval = -val end
   if absval < absprev then
      if (val < 0 and prev > 0) or
         (val > 0 and prev < 0) then
             sendit = true
      end
   else
      sendit = true
   end
   if sendit then
      if val < 0 then sendthis = 90 -- Right pan
      else sendthis = 270 -- Left pan
      end
      ipc.control(66416, sendthis) -- Pan View
      prev = val
      absprev = absval
   end
end

event.param("panning")

This solution appears smoother to me, but I don't know about sensitivity.  Try it.

 

Again, the calibration either needs numbers inserted or removed altogether as explained before. The Pan View control pans left with value 270 and right with value 90. To do the vertical panning change those numbers to 0 and 180.

 

Have fun!

 

Pete

Link to comment
Share on other sites

Edit: Whoops, I forgot to include the new lines in the .ini file. This new solution doesn't seem to work quite right. If I apply direct panning without any pitching, it works. Same way the other way around, but if I try and pan/pitch at the same time, the camera doesn't move. Also it doesn't seem to pan at all at the extreme ranges of the joystick.

Link to comment
Share on other sites

Trying your new solution and my view isn't panning at all anymore. This is what I have currently, and I also removed the calibration part as I don't believe I need it:

 

You can delete the first 4 lines too as they are not used without the calibration part.

 

I have that saved as panhdg2.lua and have it selected as LuaValue panhdg2 in the axis assignments.

 

It works fine here. Since you used a new name, did you also change the INI (the [Auto] section) to get the new file loaded? If it isn't actually running it can't do anything!

 

Also I don't see the axis moving on any of the pages in the Joystick Calibration tab. So I can't set a slope there.

 

The PAN VIEW control isn't an axis control and doesn't have calibration or slopes. It's the same control used by hats.

 

And in any case, as I said earlier, the FSUIPC calibration and slope facilities cannot work when the control is sent this way! Please reread the text accompanying the previous example. I think you missed some of it!

 

Pete

Link to comment
Share on other sites

Sorry about that, yeah I forgot the new lines in the .ini file. Basically though, as it is, it only pans/pitches some what right when I only apply either direct left/right heading pan, or up/down pitch. Also the joystick has to be moving for it to pan. If I hold it in some direction, it stops panning until I actually move the stick again.

 

Also am trying the original solution again and another thing I noticed is if I pan one way, and then want to pan the other way, the camera resets to the center position before panning the other direction.

Link to comment
Share on other sites

Sorry about that, yeah I forgot the new lines in the .ini file. Basically though, as it is, it only pans/pitches some what right when I only apply either direct left/right heading pan, or up/down pitch. Also the joystick has to be moving for it to pan. If I hold it in some direction, it stops panning until I actually move the stick again.

 

Yes, but that's the same with any solution. Inputs from axes are only ever processed when the values change.

 

Here the panning extends as far as needed, but then the joystick I've got has many positions therefore many changes in value. You might be able to get more for yours by changing the Delta value in the axis assignments -- reduce it. The number there says "ignore changes less than this". For your application you don't really want that too high.

 

Also am trying the original solution again and another thing I noticed is if I pan one way, and then want to pan the other way, the camera resets to the center position before panning the other direction.

 

 

Of course it has to go through the positions between left and right or vice versa. I thought that was the whole point. Moving the stick left pans left whilst you are moving it, but releasing it leaves the view where it was. EXACTLY as you asked for!  Therefore to pan back towards the centre you move the stick the other way. You should be able to stop it anywhere on release doing that. Naturally to get all the way from left to right or vice versa it has to go through the centre.

 

It is now sounding like you failed to explain whast you really wanted. I'm sorry, but I now don't have time to do any more on this. I thought I'd implemented EXACTLY what you specified, and that's the way it works here. You now seem to have changed your mind. :sad:

 

Pete

Link to comment
Share on other sites

Sorry for not explaining it right. I'll try and explain it better. I don't believe I need to make the panning faster the more I move the stick. So instead a complete linear panning speed, regardless of how far I move the joystick would probably be just fine. So for example:

 

Push stick left any amount, pan smoothly left and keep panning until I let go of the joystick.

Push stick right any amount, pan smoothly right and keep panning until I let go of the joystick.

Push stick up any amount, pitch smoothly down and keep pitching until I let go of the joystick.

Push stick down any amount, pitch smoothly up and keep pitching until I let go of the joystick. 

 

I can achieve what I want if I set it up as followed in the axis assignments tab:

 

Left side: all unchecked.

 

Right side: Left/Right Axis

 

Range 1: -16384 to -2048

Control sent when range entered: Pan Right (repeat checked)

 

Range 2: 2048 to 16383

Control sent when range entered: Pan Left (repeat checked)

 

Up/Down Axis:

 

Range 1: 2048 to 16383

Control sent when range entered: Pan Down (repeat checked)

 

Range 2: -16384 to -2048

Control sent when range entered: Pan Up (repeat checked)

 

This works, but the repeat rate isn't high enough to to make a smooth pan like you get when you hold spacebar and move your mouse. 

Link to comment
Share on other sites

This works, but the repeat rate isn't high enough to to make a smooth pan like you get when you hold spacebar and move your mouse. 

 

The repeat rate might be controllable by the PollInterval parameter, but I'm not sure without delving into the code, for which I've not got time at present. This parameter is decribed in the Advanced User's guide.

 

Have you tried the same but using "Pan View" instead, with the angle as the paratemter (0 up, 90 right, 180 down and 270 left)?

 

BTW the mouse look option in FSUIPC allows you to pan with the mouse using the centre button rather than having to also hold the space bar down.

 

Pete

Link to comment
Share on other sites

Just tried with Pan View and the angle set for each parameter. Identical result as the separate pans. About 5 jerky pans a second. I guess maybe what I want can't be done. I'll probably just stick with normal Axis pan/pitch and live with the view resetting to center. Thanks for helping though.

Link to comment
Share on other sites

First is I have my right analog stick setup as panning for Pitch and Heading axis. However, I was wondering if I can keep the view from resetting to center when i let go of the stick. I'd like the panned view to stay where it's at when I pitch/heading pan in some direction. Pretty much the same thing when you hold spacebar and move the mouse the view stays where it's at after moving. 

 

Hi,

 

Just came across this thread. I am not sure, if you are aware about the possibilities with the camera definitions. Have a look into the definition of the several cameras (cockpit view, virtual cockpit, etc.) in the camera.cfg file. And then have a look at the parameters set. A description of the possibilities can be found here:

 

http://msdn.microsoft.com/en-us/library/cc526984.aspx

 

Especially look at the panpbhreturn parameter. You can even define your own camera and adjust the settings accordingly. I have the feeling, that you try to solve your problem at the wrong place.

 

Rgds

Reinhard

Link to comment
Share on other sites

Thanks, there's some good sensitivity settings in that cfg file. After some testing again, if I use the default FSX controls for panning (shift/ctrl numpad), it pans smoothly in the direction I want when I press and hold the keys. So I thought well then I can just set my axis up for keypress and hold for those keys on the right side of the axis assignments tab. Unfortunately it only pans one tick at a time each time I move the joystick, like as if it's acting as keypress/release instead of keypress/hold. Not sure why this is.

 

Example: I changed all the view pan controls to WASD for simplicity. Right side of assignments tab is keypress/hold. And each parameter corresponds to the WASD key codes as per the advanced guide. However it only pans one tick at a time.

Link to comment
Share on other sites

Thanks, there's some good sensitivity settings in that cfg file. After some testing again, if I use the default FSX controls for panning (shift/ctrl numpad), it pans smoothly in the direction I want when I press and hold the keys. So I thought well then I can just set my axis up for keypress and hold for those keys on the right side of the axis assignments tab. Unfortunately it only pans one tick at a time each time I move the joystick, like as if it's acting as keypress/release instead of keypress/hold. Not sure why this is.

 

Key press repeats are controlled by either the keyboard BIOS or low level parts of Windows and the rate is pre-set there. Key presses sent artificially by another program are not processed like that, they go nowhere near any hardware driver. The only way you'd get repeated actions is if the software detecting the keypress did its own repetition until it sees the KEY UP event.

 

All that is happening with your keypress is that it is being converted by FS default assignments into the same controls you could have assigned directly. It saves you nothing at all, but bypasses the repeat facilities built into FSUIPC.

 

If I tried to implement keypress repeat it would still act at the same rate as the control/button repeat.

 

The proper way to deal with this is to adjust the repeat rate. I've investigated this after I mentioned the PollInterval parameter earlier, and see that it currently isn't adjustable using that facility, but is currently fixed at 100 mSecs (giving a rate of  a bit over 10 repeats per second. If you wish I can make that parameter user-definable, like the poll interval.  This is easy enough for me to do -- it's just that no one has needed or asked for such before. If I do it I'll pobably make it an [Axes] section parameter, so it can be different for different profiles, and it will be expressed, like the ButtonRepeat parameter, in terms of repeats per second (default 10).

 

I'll only do this for FSUIPC4 (i.e. for FSX and P3D). Look out for version 4.921 later today. The parameter will be called

 

RangeRepeatRate

 

with a default of 10. Note that the actual repeat rates will general be a little different, depending on FS loading because all this is in the same thread as the main FS simulations. But setting sy 20 will be twice as fast as setting 10. The range will be 1 - 100.

 

Regards

Pete

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.