Detect target standing at hill from ground

bluebird

Member
Hi @Justin ,

I'm using terrain for making level. The surface of level isn't flat, some area have slopes. It has hills & valley too.
I want to detect player character standing at hill using 'Can See Object'.

I tried but I failed, bcoz 'Can see object' task only checks for game objects which are in parallel to ground.
Would it be better if I use 'Within Distance' task instead of 'Can See Object'?

Check below drawing:

1501
 
Can See Object does allow for vertical detection - if it's not being detected it could be that the pivot point of the player/agent is too low so when the task does a raycast to check for collisions it is hitting the terrain. You can adjust the offset on the task in order to compensate for the pivot being at the base of the character.
 
@Justin As per integration demo, I've set Offset values to (0, 1.8, 0)
So origin of raycast would be same as above drawing. The origin is at agent's head.

Question is, does agent can see player character at hill OR does agent can see dog whose height is 1/4 of agent's height?
 
Hi @Justin

I was waiting for your input. I hope you got my point.
The field of view of 'can see object' task should be like 3d cone shape.
For example, see spotlight in scene tab. It's range is similar to cone shape.
 
The task will cast a ray from pivot point to pivot point, offseted by the Target Offset or Offset values. The field of view cone does not account for the vertical field of view, only horizontal. If you want to add this take a look at MovementUtility.WithinSight (around line 114).
 
Top