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

Solved Get direction player is moving relative to other player


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Effeff
AlliedModders Donor
Join Date: Jan 2019
Location: discord: ff#0533
Old 02-28-2021 , 18:27   Get direction player is moving relative to other player
Reply With Quote #1

I'm trying to make fist combat a little more complex in csgo (rather than just plain old flat damage every time). One of the things I want to do is make it so that when you punch someone, your damage increases relative to your speed if you were moving toward them, and decreases relative to your speed if you were moving away from them. I will be using SDKHook_OnTakeDamage to check if attacker is moving toward or away from victim, and how quickly the attacker is moving.

I'm not certain on the next step I would take from here. The picture below is my attempt at kinda showing what I plan to do. Blue punches red. Green arrow represents the direction they are running.



I think what I need to do is create a line between the attacker's origin and the victim's origin.
Then, I would get the line perpendicular to this one. This perpendicular line represents the 100% line (no increase or decrease in damage).
Next, I would create another line using the attacker's velocity vector. This line would start from the attacker's origin.
From here, I need to do something with angles to determine how I increase/decrease damage, but I am not too sure on how to go about this.


Last edited by Effeff; 03-02-2021 at 14:45.
Effeff is offline
 



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 18:44.


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