Can See Object isn't working when player is crouching

appminis

Member
I am using Behavior Designer and UFPS 1.

When the Player is in the Crouch state, the Enemy's "Can See Object" task isn't registering success. As soon as the Player stands up, it does.

Can See Object settings:


Standing UFPS player:


Crouching:


Any ideas?

Thanks!
 

Justin

Administrator
Staff member
Your offset is always set to 1.6 so when the character crouches it is no longer going to hit the character. You can either update the SharedVariable when the character is crouching or use the humanoid bone option for can see.
 

appminis

Member
Your offset is always set to 1.6 so when the character crouches it is no longer going to hit the character. You can either update the SharedVariable when the character is crouching or use the humanoid bone option for can see.

Isn't Offset for where the NPC/AI's "Eyes" are? The point of origin for where the raycast comes from the NPC to determine if it sees the player.
If so, why would that need to change when the player is crouching?

My assumption was:
Offset = AI's raycast origin
Target Offset = Target's destination for AI's raycast

Since these Offsets are in relation to the pivot point of the object (at the feet), I added 1.6 to the NPC/AI to line up with where the model's eyes are and 1 to where the Player's head is (the Target).

If anything, I would assume when crouching that I would need to reduce the Target Offset so the AI doesn't always see the player since he is not standing at a height of 1. Instead, he doesn't see him at all.

As for using the bone option, I never could get that to work for some reason - never detected it when enabled.
 

Justin

Administrator
Staff member
You're right on the offset - it should be Target Offset. There are a lot of reasons why Can See Object may return failure so the easiest way to debug this is to place a breakpoint within CanSeeObject.OnUpdate and see where it returns early. It should get all of the way to line 141 of MovementUtility.LineOfSight
 

appminis

Member
You're right on the offset - it should be Target Offset. There are a lot of reasons why Can See Object may return failure so the easiest way to debug this is to place a breakpoint within CanSeeObject.OnUpdate and see where it returns early. It should get all of the way to line 141 of MovementUtility.LineOfSight

So I actually just tried it with a Target Offset of 0. When I did that, the AI didn't see the Player when he is standing. BUT, he did see the player when the player was crouching.

I'm totally confused o_O

Any idea why that could be? I'm just using the standard UFPS1 controller.
 

Justin

Administrator
Staff member
Instead of using 0 try using 0.1 so the raycast will hit just above the character's feet.
 
Top