#AI Line of Sight

1 messages · Page 1 of 1 (latest)

elfin obsidian
#

How can I make a AI LOS system with a ray cast if it’s possible?

graceful wharf
#

Get pos of the AI and subtract it by the pos of the local player, this makes a raycast point from the AI to the Player at ALL times

#

(Note if it doesn’t work, swap the subtracted pos with each other, I honestly forget which is first but you’ll find it by playing with the math a little bit)

elfin obsidian
#

Or if that’s not possible with a raycast what other method would I use?

graceful wharf
elfin obsidian
#

I’m confused how would the spherecast widen and how would I stop it from going 360

Sry if it’s a dumb question but I don’t use raycasts and spherecasts much

#

@graceful wharf

graceful wharf
#

It has a start pos and a direction to face

#

So it starts somewhere, and then points where you make it point

elfin obsidian
#

Yes but how would it widen over distance than?

graceful wharf
#

It doesn’t, it’s a consistent size, it isn’t a cone, we don’t have a raycast that is a cone

#

Fairly sure you can make your own with some Vector math, but I’m unsure how you’d do that unfortunately

elfin obsidian
#

Oh dang
Do you know anyone that’s good at vector math?

graceful wharf
#

I don’t know anyone really lol, you could search for it inside the #1020094893458198578 threads, I’m more than sure there have been others who have asked for a method to make a conecast

elfin obsidian
#

@dense loom (sry for ping I can’t delete this message if you don’t like pings) do you know anyway to make AI Line of sight like a cone line of sight?

dense loom
#

i havent tried to make anything cone shaped so no

elfin obsidian
pallid glacier
#

Pretty sure this has been asked b4 bc I’ve answered it b4

#

But to answer ur question, you use the Vector3 Dot chip in combination with the Raycast system Truchhi explained

elfin obsidian
#

How would I combinate it like what do o connect

pallid glacier
# elfin obsidian How can I make a AI LOS system with a ray cast if it’s possible?

Acos(Vector3 Dot(AI Forward Direction, Direction Of Player)), where Direction Of Player is the direction of the player from the AI, which is Subtract(Player Position, AI Position)
Check if this value is less than or equal to ur desired angle using the Less Or Equal chip. If it is, and the Raycast from the AI to the player is uninterrupted, the player is in the line of sight.

elfin obsidian
#

Could you tell me what ports to connect possibly I don’t get what you mean or what to connect to what

#

@pallid glacier

pallid glacier
#

But until then wait for someone else to assist u

elfin obsidian
pallid glacier
#

Unless I just decide to explain it anyways but idk

pallid glacier
#

I won’t be able to join u in game

elfin obsidian
pallid glacier
#

😔

#

ONE DAY

elfin obsidian
#

Dang

elfin obsidian
pallid glacier
elfin obsidian
#

Yep

pallid glacier
#

I’ll look

elfin obsidian
#

Ok

#

Tell me if ya find anythin

pallid glacier
#

oh they changed it to "✅ Answered"

#

chat should i stay og or switch to the new meta?

elfin obsidian
pallid glacier
#

anyways mark as answered

elfin obsidian
#

Oh

pallid glacier
#

🥺

elfin obsidian
pallid glacier
#

i forgor for mobile

#

i think the 3 dots are still there tho

cobalt meteor