Advertisement
ColinStroble

Untitled

Nov 15th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. //variables
  2. static float storedLBY[65];
  3. static float lbyTimer[65];
  4. static float predictedBreakAngle[65];
  5.  
  6. if(entity->GetLowerBodyYaw() != storedLBY[i]) { //lby update
  7. entity->GetEyeAngles()->y = entity->GetLowerBodyYaw(); //setting our eyes to lby
  8. predictedBreakAngle[i] = fabsf(entity->GetLowerBodyYaw() - storedLBY[i]); //storing our predicted lby breaker delta
  9. lbyTimer[i] = entity->GetAnimTime() + Interfaces::Globals->interval_per_tick + 1.1; //use animtime, not simtime so prediction works when choking
  10. storedLBY[i] = entity->GetLowerBodyYaw(); //store a new one to exit the if statement until next update
  11. }
  12. else if(entity->SimTime() >= lbyTimer[i]) { //if our predicted time has come
  13. entity->GetEyeAngles()->y = entity->GetLowerBodyYaw(); //setting our eyes to lby
  14. lbyTimer[i] = entity->GetAnimTime() + 1.1; //predicting next update
  15. }
  16. else if(entity->GetVelocity().Length2D() > 36 && entity->GetFlags() & FL_ONGROUND) { //lazy fakewalk getaround, we both know this is lazy, correct this w/ animlayers
  17. entity->GetEyeAngles()->y = entity->GetLowerBodyYaw(); //setting our eyes to lby
  18. lbyTimer[i] = entity->GetAnimTime() + 0.22;
  19. } else { //standing
  20. //todo: add a proper lby breaker check to this in order to ensure you're using the right information & not bruteforcing when unnecessary
  21. if(breaking_lby[i]) { ///placeholder
  22. if(predicted_breaker_angle != 0.f) {
  23. entity->GetEyeAngles()->y = entity->GetLowerBodyYaw() - predictedBreakAngle[i];
  24. /* Let me explain how this works:
  25. Basically, when a LBY updates, there is a difference between a person's delta (not breaking) and the delta after update (usually breaking), meaning if you store this delta upon upon a update, it'll make a pretty accurate breaker angle to predict.
  26. */
  27. } else {
  28. // fallback bruteforce goes here
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement