From 8e7b66ba0f6bc02c031d5eef8cd2f7385e87f0c3 Mon Sep 17 00:00:00 2001 From: Anchur <809595156@qq.com> Date: Mon, 15 Feb 2021 11:11:06 +0800 Subject: [PATCH] add init velocity for ragdoll corpse --- cl_dll/GameStudioModelRenderer.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cl_dll/GameStudioModelRenderer.cpp b/cl_dll/GameStudioModelRenderer.cpp index bbc7d7f..838c43a 100644 --- a/cl_dll/GameStudioModelRenderer.cpp +++ b/cl_dll/GameStudioModelRenderer.cpp @@ -371,6 +371,11 @@ TEMPENTITY* CorpseManager::CreateRagdollCorpse(cl_entity_t* ent) gPhysics.CreateRagdollControllerHeader(tempent->entity.index, IEngineStudio.Mod_Extradata(ent->model)); gPhysics.StartRagdoll(tempent->entity.index); gPhysics.SetVelocity(tempent->entity.index, (Vector3*)&ent->curstate.velocity); + + cl_entity_t* local = gEngfuncs.GetLocalPlayer(); + Vector v = (ent->origin - local->origin).Normalize(); + v = v * 5; + gPhysics.SetVelocity(tempent->entity.index, (Vector3*)&v); gEngfuncs.Con_DPrintf("corpse [%d]'s velocity is %f\n", tempent->entity.index, ent->curstate.velocity.Length()); gEngfuncs.Con_DPrintf("create corpse [%d] for entity [%d]\n", tempent->entity.index, ent->index);