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

How canculate distance beetween two vectors?


Post New Thread Reply   
 
Thread Tools Display Modes
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 11-26-2017 , 08:07   Re: How canculate distance beetween two vectors?
Reply With Quote #11

Quote:
Originally Posted by ZASTRELIS View Post
I use my code for excepting cutom spinning which I do when grenade touches to worldspawn. Distance needed only for stop spinning, because server_frame() fire each spin in some degree. So I unneeded to change angle of grenade within ground angle, because hlds do this byself. Only +5 to Z axis for little incline, and X axis correction as 0.0

EngFunc_PointContents I not fully understand how it works, and not sure that it is suitable
As I said before I use server_frame(), while() not applicable in that native

Looked at your video, and think that angle correction should take place, but excelent correction for your ent is very hard for this engine, and not profitable
What you say about if you tried enable some gravity for your ent and disable friction, maybe it would be looks better in motion? Wheels do not rotate)
That video is of a very primitive version where only origin physics are implemented meaning it will never rotate but can move around without flying or clipping ground

I only posted it to showcase the code that checks distance to ground using the method I initially provided, so pretty much the part where it's rolling down the slope and keeps touching the ground, the image I posted is what's keeping it on the ground

I got inspiration from is_user_outside stock used in weather plugins, which does the same thing to check if sky is directly above player


You can use this to get distance to ground (by looping to ground origin then subtracting z coordinate from original position)



Assuming your entity is a single point, stock to check if in ground might work like this
- get origin
- origin_s = origin
- origin_s[2] -= 1;

If point contents origin !=solid AND point contents origin_s ==solid then is on ground

On phone so i cant write code
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
ZASTRELIS
Veteran Member
Join Date: Nov 2010
Location: Siberia, Irkutsk
Old 11-26-2017 , 10:26   Re: How canculate distance beetween two vectors?
Reply With Quote #12

I did same with TR_vecEndPos, as someone told here

Code:
is_wall_between_points(vOrigin, vEnd, id, X, Y, Z, dist)
X|Y|Z points of vector that touches the ground, dist - distance from vOrigin to {X|Y|Z}

at last I must consider ents' angularity speed, it easy to use constant angularity, I want some dynamic speed when angle changed

Last edited by ZASTRELIS; 11-26-2017 at 10:42.
ZASTRELIS 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 00:31.


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