supertuxkart-sourceforge-migration / stk-migration-test2

0 stars 0 forks source link

Support for 'cannon' #600

Open supertuxkart-sourceforge-migration opened 10 years ago

supertuxkart-sourceforge-migration commented 10 years ago

Author: hikerstk

A 'canon' is a feature that quickly moves the kart from one point of a track to another. Basic support was added in r11021. To finish the work and make it useable, we need support for this in the exporter. The idea is that artists specify two check-lines like structures: the first one the start checkline (i.e. crossing this check line will trigger the canon), the second one the line where the karts will be released (Ideally, if you trigger at the left side of the first checkline, you will arrive at the left side of the second checkline etc, allowing the user to target where they want to be when they can drive again).

1) Support in the track exporter. The following data should be added to the check structures in the scene.xml file for each canon:

   <canon kind="canon" speed="50" min-height="-0.008819" 
           p1="227.982346 109.128738" p2="229.342407 90.069756"
           target-p1="92.126266 -13.22 -117.803696"
           target-p2="79.177559 -13.22 -140.231522"/>

Speed is the speed with which the kart should be moved (we might add acceleration/deacceleration later). p1, p2, min-height is the data for a check line (start check line, which will initiate shooting the kart). target-p1/p2 are the two end points of a line at which the kart should be end up (in 3d, not 2d as specified for the check-line). The following syntax is used to add support for an arbitrary curve (instead of a normal linear interpolation):

 <canon kind="canon" speed="..." min-height="..." p1="..." p2="...">
   <curve channel="RotZ" interpolation="bezier">
    <p c="1.000 20.000" h1="-18.067 35.565" h2="20.067 4.435"/>
...
   </curve>
   <curve channel="LocX" ...>
   </curve>
  </canon>

The curve data is basically the data structures already supported for IPOs in the exporter and STK. do we want support both for a simple linear interpolation, or only curves? Perhaps automatically add a curve for a linear interpolation automatically??

2) Once this is added, please reassign to me. The following improvements need to be added to STK:

Migrated-From: https://sourceforge.net/apps/trac/supertuxkart/ticket/600

supertuxkart-sourceforge-migration commented 10 years ago

Author: auria Pretty complete as of r11061

Here is a sample output :

  <cannon speed="42.00" p1="1.00 -0.25 -1.00" p2="1.00 -0.25 -1.00" target-p1="1.00 -0.25 4.19" target-p2="1.00 -0.25 4.19">
    <curve curvetype="bezier">
      <point c="-0.072544 -1.969541 -0.217127" h1="-0.571937 -2.425529 -0.423724" h2="0.426849 -1.513554 -0.010530" />
      <point c="0.699879 0.960386 0.937317" h1="0.807366 -0.033821 0.937317" h2="0.592393 1.954592 0.937317" />
      <point c="-0.095440 3.196285 -0.199349" h1="0.527044 2.584494 0.288736" h2="-0.717925 3.808075 -0.687433" />
    </curve>
  </cannon>

Note that atm it works for bezier curves only, I didn't bother to add support for nurbs

supertuxkart-sourceforge-migration commented 10 years ago

Author: hikerstk Postponed till we have a track that uses this.