Skip to content

Commit

Permalink
add init velocity for ragdoll corpse
Browse files Browse the repository at this point in the history
  • Loading branch information
anchurcn committed Feb 15, 2021
1 parent d2b91e8 commit 8e7b66b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cl_dll/GameStudioModelRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8e7b66b

Please sign in to comment.