Raised This Month: $203 Target: $400
 50% 

Trace from a position towards a hull.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ImACow
AlliedModders Donor
Join Date: Feb 2015
Old 05-06-2020 , 18:58   Trace from a position towards a hull.
Reply With Quote #1

Hi!

I was wondering if there is any way of tracing from a point towards a hull.

I have a point fStart[3] (player eyes)
I have a end point fEnd[3] (other player abs location)
I have a hull fMin[3] & fMax[3] for the hull on the player.

Visual example: https://i.imgur.com/ROj2DWG.jpg



TR_TraceHullFilter seems not capable of this (afaik?)

Looking forward towards your feedback!
__________________

Last edited by ImACow; 05-06-2020 at 19:00.
ImACow is offline
backwards
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 05-06-2020 , 21:34   Re: Trace from a position towards a hull.
Reply With Quote #2

The best way to do this while using the engines trace ray function would be to create a model with a hitbox (same size as the player hull bounds) and spawn it at the players position. You then just race against this objects hitbox. If you want to do this without the model prop then you will have to manually raytrace yourself with just math and a visibility function to the box using a normal raytrace to the bounds of the virtual hitbox you've defined + rotation. I would suggest using a FOV check against the player to see if you are aiming near the player for optimizations first. Then check visibility with a raytrace to this player (minus the distance of the origin to its longest edge length (using players hulls will be 32 units)). If this raytrace hits nothing, then you know the path is clear to this object and a good to then manually trace against. All you have to do then is align the rotations to 90 degree axis and enumerate a length of a vector which you extend + 1 unit in a for loop for a max distance. Then check if this point is within the min\max bounds of the hitbox you've defined
backwards is offline
ImACow
AlliedModders Donor
Join Date: Feb 2015
Old 05-07-2020 , 07:38   Re: Trace from a position towards a hull.
Reply With Quote #3

Hmm, thanks @backwards,

I'm going to try some stuff out.
__________________
ImACow is offline
zipcore
Veteran Member
Join Date: Mar 2010
Location: m_flZipcore
Old 05-08-2020 , 04:48   Re: Trace from a position towards a hull.
Reply With Quote #4

What about this: https://gitlab.com/Zipcore/zStocks/-...s/bbox.inc#L98 ?

EDIT:

Here is an example: https://gitlab.com/Zipcore/Prophunt/...del_hit.sp#L54
__________________

Last edited by zipcore; 05-08-2020 at 04:54.
zipcore is offline
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 13:25.


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