Raised This Month: $51 Target: $400
 12% 

How to get direction that someone is facing


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dreyson
Member
Join Date: Nov 2019
Location: Utah
Old 03-11-2022 , 12:44   How to get direction that someone is facing
Reply With Quote #1

Currently working on a server side ragdoll mod for csgo that spawns a server ragdoll when someone dies, all is fine and dandy but ragdolls slump over (because server ragdolls are heavy) so i was thinking about setting the ragdolls velocity when it spawns

I have this right now:

Code:
 float fOrigin[3];
            GetClientAbsOrigin(client, fOrigin);

            float fAngles[3];
            GetClientAbsAngles(client, fAngles);

            float vel[3];
    vel[0] = GetRandomFloat(4000.0,5000.0);
    vel[1] = GetRandomFloat(300.0, 400.0);
    vel[2] = GetRandomFloat(4000.0,5000.0);
			
    ActivateEntity(iEntity);
TeleportEntity(iEntity, fOrigin, fAngles, vel);
Thing is, how would i find what direction the client is facing when they die and make the ragdoll fly back in the opposite direction to what they are facing so if they are looking at you and you shoot them they fly back in the opposite direction of what direction they are facing you, thanks!

Sorry for the stupid explanation :p
Dreyson is offline
Dreyson
Member
Join Date: Nov 2019
Location: Utah
Old 03-11-2022 , 13:00   Re: How to get direction that someone is facing
Reply With Quote #2

please note that i am trying to get the opposite direction of the direction that the player who got killed is facing
Dreyson is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 03-11-2022 , 14:22   Re: How to get direction that someone is facing
Reply With Quote #3

https://sm.alliedmods.net/new-api/sd...lientEyeAngles

angles[1] is the direction they are facing.
Mitchell is offline
Dreyson
Member
Join Date: Nov 2019
Location: Utah
Old 03-11-2022 , 15:23   Re: How to get direction that someone is facing
Reply With Quote #4

how do i apply velocity in that direction or get the xyz
Dreyson is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 03-11-2022 , 18:41   Re: How to get direction that someone is facing
Reply With Quote #5

Maybe SDKHook OnTakeDamagePost damagePosition helps you...

Ignore ragdoll part in this code.

But seems for example, spawn model with physics_prop_ragdoll, ragdoll is very heavy.
I did not find away to set ragdoll mass lower.
You can try scale vector with 10000 or more, but it not affect much.

Code:
public void OnClientPutInServer(int client)
{
	SDKHook(client, SDKHook_OnTakeDamagePost, OnTakeDamagePost);
}

public void OnTakeDamagePost(int victim, int attacker, int inflictor, float damage, int damagetype, int weapon, const float damageForce[3], const float damagePosition[3])
{
	if(GetClientHealth(victim) > 0)
		return;

	float attacker_eye_pos[3];
	GetClientEyePosition(attacker, attacker_eye_pos);

	float output[3];
	MakeVectorFromPoints(attacker_eye_pos, damagePosition, output);
	NormalizeVector(output, output);

	ScaleVector(output, 1000.0);
	NegateVector(output);

	float victim_pos[3];
	float victim_ang[3];
	GetClientAbsOrigin(victim, victim_pos);
	GetClientAbsAngles(victim, victim_ang);


	char model[PLATFORM_MAX_PATH];
	GetClientModel(victim, model, sizeof(model));
	int entity = CreateEntityByName("prop_physics_override");


	PrintToServer("-%s", model);
	DispatchKeyValue(entity, "model", model);
	//DispatchKeyValue(entity, "massscale", "1");
	DispatchSpawn(entity);



	TeleportEntity(entity, victim_pos, victim_ang, output);
	SetVariantString("OnUser1 !self:BecomeRagdoll::0.1:1");
	AcceptEntityInput(entity, "AddOutput");
	AcceptEntityInput(entity, "FireUser1");
}
__________________
Do not Private Message @me
Bacardi is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:42.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode