How would I make "realistic range" in a TD game

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to achieve “realistic range” in a TD game. as shown in this video: Tower Defense X Juggernaut Update… | ROBLOX - YouTube (its at the beginning of the video) it shows the range being cut out where theres obstruction and it also accounts for “field of view” instead of the cut being a straight line.
  2. What is the issue? Include screenshots / videos if possible!
    i cannot come up with any ideas on how to do it, nor the math to do it.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    i’ve tried to do it, i couldnt come up with any ideas. i cannot find any solutions on the devforum besides making a circle with parts and using collision checking, which I dont want. i want to use the negation tool to cut the section.
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

if you could give me ideas i would be thankful.

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

I’d assume that for predetermined tower placements, you could make predetermined range objects. If they are custom, use raycasts. I don’t know how to use raycasts though, so to help with coded involving them I’d likely need to learn them.

EDIT: I just realized how to use raycasts, use workspace:Raycast() while supplied with an origin and direction (both Vector3). It returns an RaycastResult object which includes .Instance as a property. Maybe try using a raycast with values from a CFrame using Position and LookAt. Supply the raycast with CFrame.Position and CFrame.LookVector * (tower range).

1 Like

thank you guys for the help! im using egomooses triangle article for this Articles/3D triangles.md at master · EgoMoose/Articles · GitHub
image
although, there is a problem. the triangle goes all the way to the part or “tower”, but as you can see in the video, the triangle cuts off at the intersecting part. any ideas on how I can fix this

you can actually just grab one of the function from Soldier Freemodel (Roblox official ones), it have field of view module

1 Like