Scripts / Entity Looking at Another Entity?

Author
Message
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 24th Jan 2021 22:15
Hey all.

I've recently been toying with a new prototype for a possible game (if it all works out) and I've created my own 3rd person control system with an entity. Got everything working as needed. With cameras, movement and etc.

What I'm curious about is how would i get the same effect as "U.PlayerLookingAt( e, dist, ignore )" but instead of the actual Player, having it detect if the entity in this case is looking at another entity?

I also have head-tracking and need to know from what angle is another entity. Wondering if there is something like floating about the forums? I'm still playing with modifying how all this works with the player and replacing with the entity, though having a lot of troubles currently with getting results. Any help would be cool.
Store Assets - Store Link
Free Assets - Resource Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 24th Jan 2021 23:22
The problem you will have is to find out which direction the entity (I assume it is a character?) is looking.

The angle and position of a character is not related to it's eyeline!

There is a function for this btw, AIGetEntityCanSee, but I'm not sure how or if it works.
Been there, done that, got all the T-Shirts!
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 25th Jan 2021 12:23
Quote: "What I'm curious about is how would i get the same effect as "U.PlayerLookingAt( e, dist, ignore )" but instead of the actual Player, having it detect if the entity in this case is looking at another entity?"

do you know the angles of the entity doing the detection? cos you can pass in ray casts pretty easily using amen's rotate function
p.s. i just placed the entity at the player's position and angle for simplicity but i still pass in the entity's values so should work with your script
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11

Attachments

Login to view attachments
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 27th Jan 2021 00:35
Quote: "do you know the angles of the entity doing the detection? "


I do thankfully. Gosh lots of to test out just to avoid one small issue. But its what i get for trying to do something different lol

Thanks a lot guys I'll check out all the functions and see what will work best. It appears the camera following an entity follows its attempt into walls too even if it visually doesn't go there. That's with the point camera. So I might be better off using SetAngle along with the functions you guys are mentioning.
Store Assets - Store Link
Free Assets - Resource Link

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GTX 960

Login to post a reply

Server time is: 2024-04-23 10:20:42
Your offset time is: 2024-04-23 10:20:42