Try to making the homing missiles turn more smoothly.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1434 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
f59f487d8a
commit
e49a415671
@ -9,7 +9,7 @@
|
||||
(max-height 1.0)
|
||||
(force-updown 25.0) ;; force raising/lowering the homing missile if it's too low/high
|
||||
(max-distance 20.0) ;; maximum distance at which a kart is still followed
|
||||
(max-turn-angle 5.0) ;; maximum turn angle when following a kart
|
||||
(max-turn-angle 65.0) ;; maximum turn angle when following a kart
|
||||
)
|
||||
|
||||
;; EOF ;;
|
||||
|
@ -77,6 +77,12 @@ void Homing::update(float dt)
|
||||
if(fabsf(steer)>90.0f) steer=0.0f;
|
||||
if(steer<-m_st_max_turn_angle) steer = -m_st_max_turn_angle;
|
||||
if(steer> m_st_max_turn_angle) steer = m_st_max_turn_angle;
|
||||
// The steering must be interpreted as grad/s (otherwise this would
|
||||
// depend on the frame rate). But this would usually miss the karts,
|
||||
// since the angle isn't adjusted quickly enough when coming closer
|
||||
// So we allow for (much) larger steering angles the closer the
|
||||
// kart is by multiplying the rotation/sec with max_distance/minDistance
|
||||
steer *=(dt*m_st_max_distance/minDistance);
|
||||
btMatrix3x3 steerMatrix(btQuaternion(0.0f,0.0f,DEGREE_TO_RAD(steer)));
|
||||
my_trans.setBasis(my_trans.getBasis()*steerMatrix);
|
||||
} // minDistance<m_st_max_distance
|
||||
|
Loading…
Reference in New Issue
Block a user