#How to make blindspot
1 messages · Page 1 of 1 (latest)
Youd just raycast outwards from the monkey, and then shape the circle based off of the raycast lengths.
See this the thing
Idk how to shape the circle
Also
Im making it sphere
You could technically do get parts in part method and reverse raycast to the tower.
Huh?
That wouldbt change anything tho
Cuz im trying to shape the circle
Ik the raycast part
Js the visual part is where i struggle
Okay so, the red dot is your turret. The yellow is your range.
For starters, you'd need to do raycasts to each of these objects vertices.
So: To start you'd do getpartsinpart, which will return all of these blocks that are in the way. You can even use a collision group to handle the raycast parameter if you want to do so.
Each of these would than raycast to the tower
(so on so forth)
from here you actually have 2 things. For starters, you have the tower's vision of the block, but also what they can see beyond the block. Lets take the right block for
From here, you actually can create a negative space for what the tower can and cant see.
The blue being the raycast, the red being a negative of the raycast, and then the yellow being what the tower can't see
Now, there may be a less barbaric method, but what I would do is create unions for the turret's range, depending on the blocks that block the vision of the turret.
ik its hard to see
and if we change the collision fidelity with a union...
bamo
it wont detect anything in that gap we just made since it's not in the part.
Whats that
Yes
That's a plugin called Mesh Optimization Tools by Maximum_ADHD
but overall that's how I would do it
more than likely there are better, more efficient, less mathematical heavy ways of doing it, but this is just the solution I came up with.
yeah thinking about it I was stupid XDDDDDDd
they more than likely just fire a constant number of raycasts
but they still probably do use the getpartsinpart method
raycasts are extremely performant. You could do thousands of them a second without noticing a difference.
How many raycast should i fire?
with method 2, youd want to fire a raycast from all towers to all the tower's get parts in part
ahhh icic
how do i find the corner tho?
like the vertices
with method 2 you wouldnt need to do that
hmm
so first
im gonna check parts in the range
2nd
fire a raycast that is aimed at the target
3rd
check if target is visible or not
4th
OKay
so
lets just do it like this
you put all the towers in a folder
for i, v in pairs(folder) do
for each tower, you want to check the type of tower. If it's an attacking tower, you want to specify.
if tower:GetAttribute("Type") == number then
Then, get the range of the tower
local range = tower:GetAttribute("Range")
then, getpartsinpart of the tower's range. (in this case a circle)
For the getpartsinpart, youll want to ignore the tower itself, and also obstacles. Reason being is because you dont care to self check itself if it exists inside it's range. You only want the targets.
From there you want to check each target in it's range.
Firing a raycast starting from the tower's position, with a lookvector to the entity, with a range of the tower's range
kk
If the raycast is interrupted by a blockade, then you recheck until the turret finds a target to hit.
recheck where
use a repeat until loop
repeat the firing?
wouldnt it just hit the same target
You'd want to fire through all the get parts in part
until you find one to hit
then you'd use a return/break once you found one to hit
ok
so im checking for targets here
yes
If the raycast doesnt find the target, then you assume the target is being obstructed.
You'd just have a one line return
oh okok i get it
and what if it is obstructed
"getpartsinpart,
if #(getpartsinpart) == <1 then return end"
What does this do
this explains raycasting to a target
if the raycast ends before it reaches it's target, that means that the view is obstructed
ok
so how does the unionizing part work
like showing the blindspot
since thats my goal
if the number of things inside of getpartsinpart is less than 1, return the script, which essentially stops the previous if statement. Stopping further code.
🤦♂️
Im explaining the second method
which is more efficient
the first method, the union one, is too complicated
which is?
im lost
😭
just do this method ffs
If there's anything you dont understand of this, make a new help post asking about that specific thing
ye but i specificly asked how to visualized the blindspot
like this
If you're wanting to 100% visualize the blindspot, and only for your own sake, then yes
You would have to do the aforementioned thing.
although you would still use getpartsinpart.
and to be honest, unioning something every frame is going to be extremely rough
but i have no idea on performant it is
check if a target is getting hit?
.
You are asking 2 different questions.
The question you just asked is unrelated to the question you asked previously
im asking 1 question tho?
1st method I talked about is only for personal viewing.
2nd method I talked about is what the actual code would do to check to see if it can hit a target or not
xD