#Tower Defense Hitbox

33 messages · Page 1 of 1 (latest)

stoic eagle
#

I have 2 types of hitboxes, radial and rectangular. I am unable to figure out how to calculate rectangular hitboxes using the following variables: 1. Tower Position(middle of a rectangles edge) 2. Rectangle Dimensions 3. Enemy Position

steel perch
#

are u using Raycast

loud stratus
#

SPATIAL QUERIES :D

stoic eagle
#

The character doesnt exist

#

its all data

#

Tower = {
Property1 = 2,
Position = vector2.new(x, y)
}
Enemy= {
Property1 = 2,
Position = vector2.new(x, y)
}

ivory kelp
#

so lets rename the variables u know a bit better

#

u know the difference of positions (vector)

#

and u know the size of the rectangle

#

correct?

stoic eagle
#

i can get any data i need from the client

#

but not the enemies position

#

i send the hitboxdata to the server

#

then it's created there

#

and it checks for enemies

ivory kelp
#

i dont really get what u mean

#

tell me exactly what you know/can get

#

and the type

#

and tell me exactly what u want

#

collision detection?

steel perch
lethal frost
stoic eagle
#

there are no parts

#

in the workspace

lethal frost
#

just replace the Part with the date you have

#
function isPointInPart(point, cf, size)
    local p = cf:PointToObjectSpace(point)
    local s = size/2
    return p.X >= -s.X and p.X <= s.x and p.Y >= -s.Y ... etc
end
lethal frost
#

Edited it

#

also looks like thats no everything