Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. bool CalculateBullet(D3DXVECTOR3 &vLocalOrigin, D3DXVECTOR3 &vAimSpot, D3DXVECTOR3 &vTargetVelocity, D3DXVECTOR3 &vLocalVelocity, FLOAT fBulletSpeed)
  2. {
  3.  
  4.  
  5. D3DXVECTOR3 vDistVec = vLocalOrigin - vAimSpot;
  6. //D3DXVECTOR3 vDistVec = D3DXVECTOR3(distmp.X, distmp.Y, distmp.Z);
  7. float flTDistance = D3DXVec3Length(&vDistVec);
  8.  
  9. FLOAT flGravityConstant = 9.81f;
  10.  
  11. FLOAT flTTI = flTDistance / fBulletSpeed;
  12.  
  13. float flDropAdjust = 0.5 * flGravityConstant * flTTI * flTTI;
  14.  
  15. vAimSpot = vAimSpot + vTargetVelocity * flTTI;
  16. // vAimSpot = vAimSpot - vLocalVelocity * flTTI;
  17. vAimSpot.y += flDropAdjust;
  18. return TRUE;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement