best way to implement a sphere around a character

hi

if you want to have a sphere (eg of visibility or reach) around a character, what is the best way to do so in terms of performance
using collision volumes on the perimeter of the character or periodically using some trace (line, box, sphere etc) by channel etc

thanks

Hey @barbrian0723!

So it would be kind of dependent on what the sphere is for! Generally you want to use a sphere trace when you want the player to choose to do something, whereas if you’re wanting it to be aim-based, you’d draw a line trace on tick!

Hope this helps!

1 Like

Spheres are pretty performant already (when choosing between collider or sphere trace). Can you provide more detail about what you are trying to make?

Also something to note is traces are great for detection but the sphere will not be detectable by other forms of detection, so if the sphere needs to be detectable in some way use a collider set as a trigger.

1 Like

consider the case of an ai animal needing to run away from an enemy

it will not be limited to the direct radius of the character, but a broader range

i thought of putting collision volumes like box collision on the edges of the character’s outer radius as an implementation of the collision method / approach

but there is also the trace approach (line trace etc) done periodically

was wondering which approach would be best performance wise also when the number of characters start to increase

Probably:

3 Likes

Hey again @barbrian0723!

Do you think you have a good understanding of implementing collisions and traces now? Make sure to mark the most appropriate solution, if so! :slight_smile:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.