Adjusting Camera Height

Information about the inner-side magic

Moderator: kilo

Adjusting Camera Height

Postby GTRdrift34 » Thu Jan 03, 2013 6:52 am

Hi everyone just wondering if it were possible through coding (not in game) to change the height of the camera view used when racing. In particular the first person view used by pressing the F2 key, it is my preferred view but it is too low, where if possible could i reprogram the height value? Thank you.
GTRdrift34
 
Posts: 13
Joined: Fri Nov 30, 2012 5:01 am

Re: Adjusting Camera Height

Postby chad3006 » Thu Jan 03, 2013 4:10 pm

Well you can edit the XML code for the particular car(s) you're racing (located in the car's folder); the driver and or the bonnet position. If you're talking about the source code -- I can't help with that.
User avatar
chad3006
 
Posts: 228
Joined: Mon Aug 13, 2012 7:56 pm
Location: USA

Re: Adjusting Camera Height

Postby mungewell » Thu Jan 03, 2013 5:41 pm

The camera positions are different in each car, and supposed to represent the 'real' driving position. The F2 internal cameras use the driver position for working out where to place the camera.
Code: Select all
   <section name="Driver">
      <attnum name="xpos" unit="m" val="-0.06"/>
      <attnum name="ypos" unit="m" val="-0.36"/>
      <attnum name="zpos" unit="m" val="4.9"/>
   </section>


As chad suggested you can change the camera positions to your liking in the XML. There is a per player configuration merged into the main files, but it appears that it assumes the same max/min values as the original XML only specs it's value (not a range)
Code: Select all
00:00:05.257 Info    Human #0 : Starting race session with 10.7 l of fuel (computed)
00:00:05.257 Trace   Checking/Merging Player specific setup into sc-spirit-300 setup.
00:00:05.258 Error   GfParmCheckHandle: parameter "Driver/zpos" out of bounds: min:0.9 max:0.9 val:4.9 in ("default car"
- "C:/Users/swood/Documents/speed-dreams-2.settings//drivers/human/car.xml")
00:00:05.259 Error   insertParamMerge: Incompatible ranges "Driver/zpos": using 0.900000 for min
00:00:05.259 Error   insertParamMerge: Incompatible ranges "Driver/zpos": using 0.900000 for max
00:00:05.260 Error   insertParamMerge: Fixing parameter "Driver/zpos": 4.900000 -> 0.900000
00:00:05.261 Error   insertParamMerge: Incompatible ranges "Driver/zpos": using 0.900000 for min
00:00:05.261 Error   insertParamMerge: Incompatible ranges "Driver/zpos": using 0.900000 for max
00:00:05.261 Error   insertParamMerge: Fixing parameter "Driver/zpos": 4.900000 -> 0.900000
00:00:05.262 Info    1 driver(s) ready to race
00:00:05.263 Info    Cars per pit: 1


So for now you'll have to adjust the original car's XML.
Simon

PS. If you really want to play in the source code, check 'grcams.cpp'
mungewell
 
Posts: 307
Joined: Fri May 20, 2011 4:05 pm
Location: Southen Alberta, Canada

Re: Adjusting Camera Height

Postby mungewell » Thu Jan 03, 2013 5:45 pm

I should also add; if you think that the default position is wrong for a particular car(s), please suggest 'better' positions here (or with Trac) and we'll get those fixed....

Simon
mungewell
 
Posts: 307
Joined: Fri May 20, 2011 4:05 pm
Location: Southen Alberta, Canada

Re: Adjusting Camera Height

Postby GTRdrift34 » Fri Jan 04, 2013 12:58 am

Thanks for the help guys both responses were very useful. I ended up modifying the particular car xml file (sc-boxer-96) and adjusting the bonnet and driver height. It gave me a view which was higher off the ground. I also tweaked some values in the grcam.cpp for the cGrCarCamInfrontFixedCar class, i was trying to increase the value of center[2] but this seemed to change the angle of view in the z axis rather than the height of the forward looking camera. I am trying to get the most realistic view possible as i am looking at collecting gaze fixation data using the simulator so i wanted the most realistic 'viewing' experience for my user studies.
GTRdrift34
 
Posts: 13
Joined: Fri Nov 30, 2012 5:01 am

Re: Adjusting Camera Height

Postby mungewell » Fri Jan 04, 2013 5:39 pm

The cameras need an 'eye' position and a 'look at' position (which is projected forward from the 'eye'). I think 'center[2]' is part of the 'look at', hence changing the angle of view.

To keep the view level you want to change both:
http://sourceforge.net/apps/trac/speed-dreams/browser/trunk/src/modules/graphic/ssggraph/grcam.cpp#L675
http://sourceforge.net/apps/trac/speed-dreams/browser/trunk/src/modules/graphic/ssggraph/grcam.cpp#L691

Have fun,
Simon
mungewell
 
Posts: 307
Joined: Fri May 20, 2011 4:05 pm
Location: Southen Alberta, Canada

Re: Adjusting Camera Height

Postby mungewell » Mon Feb 04, 2013 4:17 pm

Each of the cars has an 'XML' file which contains parameters for the simulation, for example
Code: Select all
C:\Program Files\speed-dreams-2.0.0\data\cars\sc-boxer-96\sc-boxer-96.xml


Within this file there is a section which defines the positions of the driver's eye and bonnet
Code: Select all
   <section name="Bonnet">
      <attnum name="xpos" unit="m" val="0.60"/>
      <attnum name="ypos" unit="m" val="0.0"/>
      <attnum name="zpos" unit="m" val="1.0"/>
   </section>

   <section name="Driver">
      <attnum name="xpos" unit="m" val="-0.15"/>
      <attnum name="ypos" unit="m" val="0.35"/>
      <attnum name="zpos" unit="m" val="0.85"/>
   </section>


Changing these parameters will re-position the respective cameras. Some cameras use the diamensions/centre of gravity of the car, and shouldn't be changed.

Simon
mungewell
 
Posts: 307
Joined: Fri May 20, 2011 4:05 pm
Location: Southen Alberta, Canada


Return to SD Physics & Internals

Who is online

Users browsing this forum: No registered users and 1 guest