-------------------------------------------------------------------------------- Description: Normal timing, will update the damage position incl target interpolation and keep a diretion vector to the source of the shooting --------------------------------------------------------------------------------
| 193 | // and keep a diretion vector to the source of the shooting |
| 194 | // -------------------------------------------------------------------------------- |
| 195 | void EveTurretTarget::Update( float deltaT, const Vector3* source ) |
| 196 | { |
| 197 | if( m_object ) |
| 198 | { |
| 199 | // update the position & diretion |
| 200 | GetImpactPosition( m_targetPosition, source ); |
| 201 | |
| 202 | Vector3 dirToSource( *source - m_targetPosition ); |
| 203 | |
| 204 | // update the miss position |
| 205 | m_object->GetMissPosition( &m_targetPosition, source, &m_positionMiss ); |
| 206 | m_positionMiss += m_randomMissPositionOffset; |
| 207 | Vector3 direction = m_positionMiss - *source; |
| 208 | |
| 209 | if( m_laserMissBehaviour ) |
| 210 | { |
| 211 | direction = Normalize( direction ); |
| 212 | m_positionMiss += direction * 250000.f; |
| 213 | } |
| 214 | else |
| 215 | { |
| 216 | float dist = Length( direction ); |
| 217 | direction /= dist; |
| 218 | m_positionMiss += direction * ( dist + 5000.f ) * ( 1.f + 0.5f * m_randomMissDistanceOffset ); |
| 219 | } |
| 220 | |
| 221 | if( m_impactBehaviour == ImpactBehaviour::DAMAGE_LOCATOR ) |
| 222 | { |
| 223 | // update the impacts |
| 224 | if( m_impactID != -1 ) |
| 225 | { |
| 226 | m_object->UpdateImpact( m_targetPosition, dirToSource, m_impactID ); |
| 227 | } |
| 228 | |
| 229 | // what about delayed impact creation? |
| 230 | if( m_impactDelay > 0.f && m_impactSize > 0.f ) |
| 231 | { |
| 232 | m_impactDelay -= deltaT; |
| 233 | if( m_impactDelay < 0.f ) |
| 234 | { |
| 235 | m_impactID = m_object->CreateImpact( m_locator, dirToSource, m_impactLength, m_impactSize ); |
| 236 | m_impactDelay = -1.f; |
| 237 | } |
| 238 | } |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | m_trackingPosition = m_targetPosition; |
| 243 | // are we still fading from an old position? |
| 244 | if( m_positionOldInfluence > 0.f ) |
| 245 | { |
| 246 | // lerp the old position "in" |
| 247 | m_trackingPosition = Lerp( m_targetPosition, m_positionOld, m_positionOldInfluence ); |
| 248 | // fadeout the influence |
| 249 | m_positionOldInfluence -= deltaT; |
| 250 | } |
| 251 | } |
| 252 |
no test coverage detected