-
Автор темы
- #1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
I know there have been posted many thread's about this topic but i think its still not clear for newcomer's to understand what, how and where Resolver itself should be made. For me best way of finding player's side is animation's mainly, maybe some other thing's like tracing in case animation's fail. what many of you do is create local animstate and modify goalfeetyaw from there (from most resolver's i see here) example:
what you need to do to set goalfeetyaw that server use's is modify it directly from player example:
you need to do this just if you want to modify goalfeetyaw if you want to use it in some calculation's you dont. now let's move on resolving player. i would like to start on check's for animation resolve witch would be:
to determine players side while he is moving we will do simple delta comparing. now comparing itself is not so hard but setup itself for animation's for newcomer's may be.
soo let's start with setup, what we want now to do is make an layer example:
next is to memcpy each layer for each matrix. we firstly modify our goalfeetyaw in update_animations and next we update client side animations and setup matrixes, after that we memcpy our layers,
example:
you could learn more about memcpying on
next we make delta's for each playbackrate, example:
make sure we fabsf our values because we dont know what playbackrate is bigger between each other. now now comparing itself i would leave up to you.
delta detection is pretty much self-research i would recomment you take look at:
now for resolving stand we can compare angles' and use trace for side. only delta detection that i am aware of it for stand is to check if player is extended, example:
when player is extending he is most likely using max delta, else if he is not extending we would put out brute value somewhere in the middle like max delta * 0.85f.
now lets move on detecting his side. there is not much too explain about comparing angles here, example:
now this is only for extended aka high delta value. for lower delta value we would need to use traces. (note this is only for standing) detecting with trace would be:
when extending our brute angle ( we cant really determine his real angle delta here when standing we can just take our best guess) would be max desync angle function ( i would not explain this function because you have it in your local lw source). when enemy is not extending and he is standing our brute angle would be max_desync_angle * 0.80f (somewhere in the middle enough for safepoints to overlap them). now we can just set our goalfeetyaw from our data we got, example:
really hope this helps someone and there would be no more llama blatantly pasted resolvers or even worse weave resolvers.
Код:
auto animstate = player->get_animation_state();
animstate->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y + bruteyaw);
Код:
player->get_animation_state()->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y + bruteyaw);
Код:
auto UseAnimLayerResolve = (Speed > 5.0f && layers[6].m_flPlaybackRate > 0.0f);
// Speed 5 means full movement start
soo let's start with setup, what we want now to do is make an layer example:
Код:
AnimationLayer ResolverLayers[3][13];
example:
Код:
// modifying goalfeetyaw for left(negative matrix)
animstate->m_flGoalFeetYaw = math::normalize_yaw(e->m_angEyeAngles().y - 58.0f);
// then we run an update_clientside_animation to update our data for current goalfeetyaw
g_ctx.globals.updating_animation = true;
e->update_clientside_animation();
g_ctx.globals.updating_animation = false;
// and now we setup our matrix
setup_matrix(e, animlayers, NEGATIVE_MATRIX);
//now what do we do here is empty current animstate soo we dont use previous one
memcpy(animstate, &state, sizeof(c_baseplayeranimationstate));
// and we finally memcpy our layers
memcpy(record->m_ResolverLayers[2], e->get_animlayers(), sizeof(AnimationLayer) * 13);
Пожалуйста, авторизуйтесь для просмотра ссылки.
. okay now lets move on the topic. now comparing itself starts here. in our moving check or playbackrate check we settup each playbackrate example: (you can just go raw instead of this but i recommend doing like this)
Код:
float_t CenterYawPlaybackRate = player_record->m_ResolverLayers[0][6].m_flPlaybackRate;
float_t RightYawPlaybackRate = player_record->m_ResolverLayers[1][6].m_flPlaybackRate;
float_t LeftYawPlaybackRate = player_record->m_ResolverLayers[2][6].m_flPlaybackRate;
Код:
float_t CenterYawPlaybackRateDelta = fabsf(CenterYawPlaybackRate - ServerYawPlaybackRate);
float_t RightYawPlaybackRateDelta = fabsf(RightYawPlaybackRate - ServerYawPlaybackRate);
float_t LeftYawPlaybackRateDelta = fabsf(LeftYawPlaybackRate - ServerYawPlaybackRate);
delta detection is pretty much self-research i would recomment you take look at:
Пожалуйста, авторизуйтесь для просмотра ссылки.
now for resolving stand we can compare angles' and use trace for side. only delta detection that i am aware of it for stand is to check if player is extended, example:
Код:
auto IsExtended = (layers[3].weight == 0.0f && layers[3].cycle == 0.0f);
now lets move on detecting his side. there is not much too explain about comparing angles here, example:
Код:
auto Delta = math::normalize_yaw(player->m_angEyeAngles().y - AnimationState->m_flGoalFeetYaw);
if (Delta > 35.0f)
ResolvedSide[idx] = -1;
else if (Delta < -35.0f)
ResolvedSide[idx] = 1;
Код:
Vector src3D, dst3D, forward, right, up, src, dst;
float back_two, right_two, left_two;
trace_t tr;
Ray_t ray, ray2, ray3, ray4, ray5;
CTraceFilter filter;
math::angle_vectors(Vector(0, GetBackwardYaw(player), 0), &forward, &right, &up);
filter.pSkip = player;
src3D = player->get_shoot_position();
dst3D = src3D + (forward * 384); // number 384 represents how far trace will go
ray.Init(src3D, dst3D);
m_trace()->TraceRay(ray, MASK_SHOT, &filter, &tr);
back_two = (tr.endpos - tr.startpos).Length();
ray2.Init(src3D + right * 30, dst3D + right * 30);
m_trace()->TraceRay(ray2, MASK_SHOT, &filter, &tr);
right_two = (tr.endpos - tr.startpos).Length();
ray3.Init(src3D - right * 30, dst3D - right * 30);
m_trace()->TraceRay(ray3, MASK_SHOT, &filter, &tr);
left_two = (tr.endpos - tr.startpos).Length();
if (left_two > right_two)
ResolvedSide[idx] = -1;
else if (right_two > left_two)
ResolvedSide[idx] = 1;
else
ResolvedSide[idx] = 0;
Код:
player->get_animation_state()->m_flGoalFeetYaw = math::normalize_yaw(player->m_angEyeAngles().y + (ResolvedSide[idx] * ResolvedDelta[idx]));
Последнее редактирование: