Raised This Month: $248 Target: $400
 62% 

[CS:GO] Calculate jump distance(long jump)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Rogerbot
New Member
Join Date: Jul 2020
Old 07-22-2020 , 18:34   [CS:GO] Calculate jump distance(long jump)
Reply With Quote #1

Is it possible to calculate the distance only starting from the red line (https://prnt.sc/tmv7qq), if someone is running in the white part and jumps before the red line only calculates the distance between the red line and land position, something like this: https://previews.123rf.com/images/ar...ustration-.jpg
Rogerbot is offline
Kellan123
AlliedModders Donor
Join Date: Aug 2012
Old 07-23-2020 , 10:23   Re: [CS:GO] Calculate jump distance(long jump)
Reply With Quote #2

https://sm.alliedmods.net/new-api/ve...VectorDistance

Last edited by Kellan123; 07-23-2020 at 10:23.
Kellan123 is offline
Rogerbot
New Member
Join Date: Jul 2020
Old 07-23-2020 , 15:51   Re: [CS:GO] Calculate jump distance(long jump)
Reply With Quote #3

Quote:
Originally Posted by Kellan123 View Post
I've seen that when i was searching for this, but how do i get players landing position and if i use that how can i make it so when players jump from different positions like these https://prnt.sc/tngwut (red line is where they jump, green and blue is the air time and yellow is the landing) end up with the same result so the player that jumped diagonally doesn't get more distance.
I don't know if i was clear, english isn't my first language and thank you for the response.
Rogerbot is offline
kadet.89
Veteran Member
Join Date: Nov 2012
Old 07-26-2020 , 11:00   Re: [CS:GO] Calculate jump distance(long jump)
Reply With Quote #4

You can calculate the trajectory and then trace it against a solid surface.
Here is a small explanation https://translate.google.com/transla...st%2F131931%2F
Read the description below the image with jumping mario.
Use TR_TraceRay to get an intersection point with a solid surface.

The information you need is in these properties:
m_angAbsRotation - player angle
m_vecAbsOrigin - player position
m_vecAbsVelocity - player velocity
m_flGravity - gravity
m_flFriction - friction
GetGameTime() - engine time

To get the jump moment hook PlayerRunCmd and check if IN_JUMP button is pressed. Alternatively you can use m_hGroundEntity property. It is only valid when player is on the ground.
If the surface is curved, use TR_TraceHull, it will give a more precise result.
And one more thing - players can change their trajectory while in the fly. To make sure it doesn't happen, return Plugin_Handle in PlayerRunCmd.

Last edited by kadet.89; 07-26-2020 at 11:10.
kadet.89 is offline
Send a message via Skype™ to kadet.89
Reply


Thread Tools
Display Modes

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 04:53.


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