Errors after upgrading

User avatar
jjahuijbregts
Site Admin
Posts: 1926
Joined: Wed Apr 22, 2015 7:25 pm
Contact:

Re: Errors after upgrading

Postby jjahuijbregts » Mon Dec 19, 2016 10:55 am

Fairennuff wrote:ok so I have played with both those variables and it seems there is no way to make is so that even if the SightTarget is 100% visible to not see them. I'm trying to implement this asset with my game but my game uses a Thief style light detector to see if the player is standing in the light. If so it makes them visible. The darker the area they are in the harder they are to see.

I've turned the multipliers up and down and basically tried several different configurations (even turned Visbility Multiplier down to 0) and enemies are still have to detect them (even with the enemies min vis set to .9).

Is there anyway to override the detection method to first check if the player is above a certain light level before even starting detection?

Thanks!
Craig


Do you have the option "Instantly detect" enabled on the observer? This can overwrite the detection settings.

And yes, you can add your own behavior to your sight (observers use the sight to detect a target).

For example:

Code: Select all

var sight = myObserver.sight;
sight.canDetectPredicates += CanDetectTarget;


protected bool CanDetectTarget(SightTargetInfo info)
{
   // if in shadow, if in light...
   return false;
}


Fairennuff
Posts: 11
Joined: Thu Dec 15, 2016 2:20 am

Re: Errors after upgrading

Postby Fairennuff » Tue Dec 20, 2016 1:50 am

Can Instantly detect targets and Can be instantly detected are both unchecked. But still they are able to see my avatar when minvisibility is set to 0.

Trying to see if I can extend or write my own Sight behavior but I'm fairly new so struggling with it.

Thanks,
Craig

User avatar
jjahuijbregts
Site Admin
Posts: 1926
Joined: Wed Apr 22, 2015 7:25 pm
Contact:

Re: Errors after upgrading

Postby jjahuijbregts » Tue Dec 20, 2016 3:18 pm

Fairennuff wrote:Can Instantly detect targets and Can be instantly detected are both unchecked. But still they are able to see my avatar when minvisibility is set to 0.

Trying to see if I can extend or write my own Sight behavior but I'm fairly new so struggling with it.

Thanks,
Craig


min visibility is the amount of how much the target should be visible before it can get detected. So, if you set it to 0 the object can be detected if it's already 0% visible.

I've set the visibility multiplier to 0 for a target behavior and it can't get detected (as intended).
Image

Observer:
Image

Fairennuff
Posts: 11
Joined: Thu Dec 15, 2016 2:20 am

Re: Errors after upgrading

Postby Fairennuff » Thu Dec 22, 2016 2:16 pm

I have
var sight = GetComponent<ObserverBehaviour>().sight;
sight.canDetectPredicates += CanDetectTarget;
In my awake method for my AI behavior and it shows this as an error
Capture.PNG
Capture.PNG (2.78 KiB) Viewed 480 times


This is copy paste from you code. Only change is how I access my Observer component. Am I placing this in the wrong place?

I'll get some screen shots of my observer and sight target - when I set min visibility to 0 my observer still detects the target and it always reports 9% visible and still somehow detects the target when the observer's min visibility is set to .6 (60%).

Thanks,
Craig

Fairennuff
Posts: 11
Joined: Thu Dec 15, 2016 2:20 am

Re: Errors after upgrading

Postby Fairennuff » Fri Dec 23, 2016 12:20 am

Here are some pics of my observer and sight target during play. Note the min vis is 0 and the observer is set it to .6 min vis required.

Capture1.PNG
Capture1.PNG (24.53 KiB) Viewed 477 times

Capture2.PNG
Capture2.PNG (32.48 KiB) Viewed 477 times

User avatar
jjahuijbregts
Site Admin
Posts: 1926
Joined: Wed Apr 22, 2015 7:25 pm
Contact:

Re: Errors after upgrading

Postby jjahuijbregts » Fri Dec 23, 2016 6:29 pm

Fairennuff wrote:I have
var sight = GetComponent<ObserverBehaviour>().sight;
sight.canDetectPredicates += CanDetectTarget;
In my awake method for my AI behavior and it shows this as an error
Capture.PNG


This is copy paste from you code. Only change is how I access my Observer component. Am I placing this in the wrong place?

I'll get some screen shots of my observer and sight target - when I set min visibility to 0 my observer still detects the target and it always reports 9% visible and still somehow detects the target when the observer's min visibility is set to .6 (60%).

Thanks,
Craig


Oh sorry, my bad, the predicates are in a list, not an event system:

var sight = GetComponent<ObserverBehaviour>().sight;
sight.canDetectPredicates.Add(CanDetectTarget);

private bool CanDetectTarget(SightTargetInfo info)
{
// Do test here..
return true;
}

Fairennuff
Posts: 11
Joined: Thu Dec 15, 2016 2:20 am

Re: Errors after upgrading

Postby Fairennuff » Wed Jan 18, 2017 3:22 pm

Hey there. Sorry to resurrect this Thread. Your last response helped me a ton so thank you for that.

I'm now running into an issue where when my Observer enemies get very close to you (the sight target) they can sometimes stop detecting you. Basically all I'd like to do to fix this is add an if statement somehwere that says if(sight target isDetected && sight target distance < minDistance){Sight target is always detected}. So if you've been seen and you'r close to the enemy they never lose you.

How would I go about extending the detected/not detected method for my Observers?

Thanks!

User avatar
jjahuijbregts
Site Admin
Posts: 1926
Joined: Wed Apr 22, 2015 7:25 pm
Contact:

Re: Errors after upgrading

Postby jjahuijbregts » Wed Jan 18, 2017 4:37 pm

Fairennuff wrote:Hey there. Sorry to resurrect this Thread. Your last response helped me a ton so thank you for that.

I'm now running into an issue where when my Observer enemies get very close to you (the sight target) they can sometimes stop detecting you. Basically all I'd like to do to fix this is add an if statement somehwere that says if(sight target isDetected && sight target distance < minDistance){Sight target is always detected}. So if you've been seen and you'r close to the enemy they never lose you.

How would I go about extending the detected/not detected method for my Observers?

Thanks!


You could add a callback script to the observer ( http://devdog.io/unity-assets/los-pro/d ... rcallbacks ), you'll receive a callback when the object becomes (partially) visible. Simply set the info.isDetected = true; and the target will be considered detected. You could even change the target's detection settings.

Fairennuff
Posts: 11
Joined: Thu Dec 15, 2016 2:20 am

Re: Errors after upgrading

Postby Fairennuff » Wed Jan 18, 2017 8:27 pm

Ha, that was obvious... I was seriously over complicating that.

Thanks!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest