#How to calculate hits outside of workspace?

1 messages · Page 1 of 1 (latest)

muted tusk
#

I am working on a fighting module and i'm using lag compensation, I have information about players ~20 studs away at the timestamp (servertimenow - half of players ping), I just want to know how to calculate if a hit happened without moving anything in the real workspace

chrome geyser
visual zodiac
#

like hitbox datas ig

visual zodiac
#

crazy

chrome geyser
visual zodiac
muted tusk
#

I just want to compare it to the hitbox to find if it is inside the hitbox

#

im thinking about using pointtobjectinspace

#

whatever its called

chrome geyser
#

Alright I don't have very much experience with melee combat and such

#

But the goal seems simple enough

#

You're just trying to see if a point is within any hitboxes right

muted tusk
#

yeah

#

but I cannot do it in the workspace since it uses past player positions for it

chrome geyser
#

Alright this probably isn't the most efficient or cleanest solution but you could just loop through all players in the game and then use a simple mathematical approach to check if the point is in their hitbox

muted tusk
#

but i've optimized it up abit by only calculating for players like 20 studs in magnitude away from the player

chrome geyser
#

So yeah

#

easiest approach would be like you mentioned

#

Use PointToObjectSpace to convert the point into the hitbox's object space

muted tusk
#

just gotta find out a way to actually do that

#

since i never used it before

chrome geyser
#

Then check if the point's X Y and Z are smaller than or equal to half the size of the box

chrome geyser
chrome geyser
muted tusk
#

yeah

#

thanks for help

chrome geyser
# muted tusk just gotta find out a way to actually do that
local pointPosition = ...
local hitboxCFrame = ...
local hitboxSize = ...

local pointPosObjectSpace = hitboxCFrame:PointToObjectSpace(pointPosition)

local isInHitbox = math.abs(pointPosObjectSpace.X) <= hitboxSize.X/2 ..etc for all axes


#

there

#

thats all you should need

chrome geyser