Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //variables
- static float storedLBY[65];
- static float lbyTimer[65];
- static float predictedBreakAngle[65];
- if(entity->GetLowerBodyYaw() != storedLBY[i]) { //lby update
- entity->GetEyeAngles()->y = entity->GetLowerBodyYaw(); //setting our eyes to lby
- predictedBreakAngle[i] = fabsf(entity->GetLowerBodyYaw() - storedLBY[i]); //storing our predicted lby breaker delta
- lbyTimer[i] = entity->GetAnimTime() + Interfaces::Globals->interval_per_tick + 1.1; //use animtime, not simtime so prediction works when choking
- storedLBY[i] = entity->GetLowerBodyYaw(); //store a new one to exit the if statement until next update
- }
- else if(entity->SimTime() >= lbyTimer[i]) { //if our predicted time has come
- entity->GetEyeAngles()->y = entity->GetLowerBodyYaw(); //setting our eyes to lby
- lbyTimer[i] = entity->GetAnimTime() + 1.1; //predicting next update
- }
- else if(entity->GetVelocity().Length2D() > 36 && entity->GetFlags() & FL_ONGROUND) { //lazy fakewalk getaround, we both know this is lazy, correct this w/ animlayers
- entity->GetEyeAngles()->y = entity->GetLowerBodyYaw(); //setting our eyes to lby
- lbyTimer[i] = entity->GetAnimTime() + 0.22;
- } else { //standing
- //todo: add a proper lby breaker check to this in order to ensure you're using the right information & not bruteforcing when unnecessary
- if(breaking_lby[i]) { ///placeholder
- if(predicted_breaker_angle != 0.f) {
- entity->GetEyeAngles()->y = entity->GetLowerBodyYaw() - predictedBreakAngle[i];
- /* Let me explain how this works:
- 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.
- */
- } else {
- // fallback bruteforce goes here
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement