Revision: 1693
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=1693&view=rev
Author:   rorthomas
Date:     2011-02-22 20:58:27 +0000 (Tue, 22 Feb 2011)

Log Message:
-----------
fixes Bug #198

Modified Paths:
--------------
    trunk/source/main/physics/Beam.cpp
    trunk/source/main/physics/BeamData.h
    trunk/source/main/physics/BeamForcesEuler.cpp
    trunk/source/main/physics/input_output/BeamLoadTruck.cpp

Modified: trunk/source/main/physics/Beam.cpp
===================================================================
--- trunk/source/main/physics/Beam.cpp  2011-02-20 17:51:11 UTC (rev 1692)
+++ trunk/source/main/physics/Beam.cpp  2011-02-22 20:58:27 UTC (rev 1693)
@@ -3549,8 +3549,8 @@
                if (difftoBeamL > beams[i].longbound*beams[i].L || difftoBeamL 
< -beams[i].shortbound*beams[i].L)
                {
                        // block reached...hard bump in soft mode with 4x 
default damping
-                       if (k < DEFAULT_SPRING) k=DEFAULT_SPRING;
-                       if (d < DEFAULT_DAMP*4.0f) d = DEFAULT_DAMP*4.0f;
+                       if (k < beams[i].shock->sbd_spring) k = 
beams[i].shock->sbd_spring;
+                       if (d < beams[i].shock->sbd_damp) d = 
beams[i].shock->sbd_damp;
                }
        }
 
@@ -3561,8 +3561,8 @@
                        if (beams[i].shock && beams[i].shock->flags & 
!SHOCK_FLAG_ISTRIGGER) // this is NOT a trigger beam
                        {
                                // hard (normal) shock bump
-                               k=DEFAULT_SPRING;
-                               d=DEFAULT_DAMP;
+                               k = beams[i].shock->sbd_spring;
+                               d = beams[i].shock->sbd_damp;
                        }
                }
                if (beams[i].shock && beams[i].shock->flags & 
SHOCK_FLAG_ISTRIGGER && beams[i].shock->trigger_enabled)  // this is a trigger 
and its enabled

Modified: trunk/source/main/physics/BeamData.h
===================================================================
--- trunk/source/main/physics/BeamData.h        2011-02-20 17:51:11 UTC (rev 
1692)
+++ trunk/source/main/physics/BeamData.h        2011-02-22 20:58:27 UTC (rev 
1693)
@@ -304,11 +304,13 @@
        float dampout;
        float sprogout;
        float dprogout;
-       int trigger_cmdlong;                    // F-key for trigger injection 
longbound-check
-       int trigger_cmdshort;                   // F-key for trigger injection 
shortbound-check
-       bool trigger_enabled;                   // general trigger,switch and 
blocker state
-       float trigger_switch_state;             // needed to avoid 
doubleswitch, bool and timer in one
-       float trigger_boundary_t;               // optional value to tune 
trigger_switch_state autorelease
+       float sbd_spring;               // set beam default for spring
+       float sbd_damp;                 // set beam default for damping
+       int trigger_cmdlong;            // F-key for trigger injection 
longbound-check
+       int trigger_cmdshort;           // F-key for trigger injection 
shortbound-check
+       bool trigger_enabled;           // general trigger,switch and blocker 
state
+       float trigger_switch_state;     // needed to avoid doubleswitch, bool 
and timer in one
+       float trigger_boundary_t;       // optional value to tune 
trigger_switch_state autorelease
 };
 
 struct collcab_rate

Modified: trunk/source/main/physics/BeamForcesEuler.cpp
===================================================================
--- trunk/source/main/physics/BeamForcesEuler.cpp       2011-02-20 17:51:11 UTC 
(rev 1692)
+++ trunk/source/main/physics/BeamForcesEuler.cpp       2011-02-22 20:58:27 UTC 
(rev 1693)
@@ -103,8 +103,17 @@
                                                        float 
interp_ratio=difftoBeamL-beams[i].longbound*beams[i].L;
 
                                                        // hard (normal) shock 
bump
-                                                       
k=k+(DEFAULT_SPRING-k)*interp_ratio;
-                                                       
d=d+(DEFAULT_DAMP-d)*interp_ratio;
+                                                       float tspring = 
DEFAULT_SPRING;
+                                                       float tdamp = 
DEFAULT_DAMP;
+
+                                                       //skip camera, wheels 
or any other shocks wich are not generated in a shocks or shocks2 section
+                                                       if (beams[i].type == 
BEAM_HYDRO || beams[i].type == BEAM_INVISIBLE_HYDRO)
+                                                       {
+                                                               tspring = 
beams[i].shock->sbd_spring;
+                                                               tdamp = 
beams[i].shock->sbd_damp;
+                                                       }
+                                                       k=k+(tspring - 
k)*interp_ratio;
+                                                       d=d+(tdamp - 
d)*interp_ratio;
                                                }
                                                else if (difftoBeamL < 
-beams[i].shortbound*beams[i].L)
                                                {
@@ -112,8 +121,16 @@
                                                        float 
interp_ratio=-beams[i].shortbound*beams[i].L-difftoBeamL;
 
                                                        // hard (normal) shock 
bump
-                                                       
k=k+(DEFAULT_SPRING-k)*interp_ratio;
-                                                       
d=d+(DEFAULT_DAMP-d)*interp_ratio;
+                                                       float tspring = 
DEFAULT_SPRING;
+                                                       float tdamp = 
DEFAULT_DAMP;
+                                                       //skip camera, wheels 
or any other shocks wich are not generated in a shocks section
+                                                       if (beams[i].type == 
BEAM_HYDRO || beams[i].type == BEAM_INVISIBLE_HYDRO)
+                                                       {
+                                                               tspring = 
beams[i].shock->sbd_spring;
+                                                               tdamp = 
beams[i].shock->sbd_damp;
+                                                       }
+                                                       k=k+(tspring - 
k)*interp_ratio;
+                                                       d=d+(tdamp - 
d)*interp_ratio;   
                                                }
                                        }
                                        else // We assume the bounded=SHOCK2 
case
@@ -373,7 +390,7 @@
                                        if (props[propi].animFlags[animnum] & 
ANIM_FLAG_AILERONS) cstate += hydroaileronstate;
                                        //elevator
                                        if (props[propi].animFlags[animnum] & 
ANIM_FLAG_ELEVATORS) cstate += hydroelevatorstate;
-                                       //rudder Liftec
+                                       //rudder
                                        if (props[propi].animFlags[animnum] & 
ANIM_FLAG_ARUDDER) cstate += hydrorudderstate;
                                        //permanent
                                        if (props[propi].animFlags[animnum] & 
ANIM_FLAG_PERMANENT) cstate += 1.0f;

Modified: trunk/source/main/physics/input_output/BeamLoadTruck.cpp
===================================================================
--- trunk/source/main/physics/input_output/BeamLoadTruck.cpp    2011-02-20 
17:51:11 UTC (rev 1692)
+++ trunk/source/main/physics/input_output/BeamLoadTruck.cpp    2011-02-22 
20:58:27 UTC (rev 1693)
@@ -1144,6 +1144,8 @@
                        else
                                shocks[free_shock].trigger_boundary_t = 1.0f;
                        shocks[free_shock].flags = shockflag;
+                       shocks[free_shock].sbd_spring = default_spring;
+                       shocks[free_shock].sbd_damp = default_damp;
                        free_shock++;
                }
                
@@ -1219,6 +1221,8 @@
                        beams[pos].shock = &shocks[free_shock];
                        shocks[free_shock].beamid = pos;
                        shocks[free_shock].flags = shockflag;
+                       shocks[free_shock].sbd_spring = default_spring;
+                       shocks[free_shock].sbd_damp = default_damp;
                        free_shock++;
                }
                else if (mode==56)
@@ -1321,6 +1325,8 @@
                        shocks[free_shock].dprogout = pdout;
                        shocks[free_shock].beamid = pos;
                        shocks[free_shock].flags = shockflag;
+                       shocks[free_shock].sbd_spring = default_spring;
+                       shocks[free_shock].sbd_damp = default_damp;
                        free_shock++;
                }
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Rigsofrods-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel

Reply via email to