edited August 16 in ORK Support
Hi everyone,

I have been trying to set this up reading several discussion related to Raycast.
But still fail.
I am not sure if it's because Real Time Batter caused the Raycast not working properly?

Anyone know where I can read more details about raycast for Real Time Battle or tutorials, please point me to.

Thanks a lot.
Post edited by bomobee on
  • Are you using the move ai raycast or are you using the event system to detect the player?
  • edited August 16
    Hi Shadow_Fire

    I use Move AI to detect player.
    I set Move AI detection to detect by sight, use Raycast.
    And Layer Mask of Raycast I changed it from Player to Ignore Raycast, Everything, Nothing.
    These all layer mask also give same result.

    Once I reach the rage of detection, NPC behind wall will start hunting me.
    I tried several settings but same result, NPC will always detect me through wall.

    Even I uncheck Use Detection in Move AI, but the NPC still always detect player.
    The only thing that can make the NPC idle and not hunting is to uncheck Use Move AI of that combatant.
    Not sure if anything wrong with the setting in Move AI?

    I also checked and removed Battle AI from the combatant too, but still detecting and hunting.

    FYI: I am using Real Time Battle (whole scene).
    Also using Opsive Third Person Controller in this project.

    Do you have any idea about what I missed in setting?

    Thanks so much.
    Post edited by bomobee on
  • It's most likely that the player isn't detected by the move AI, but targeted by an action of the combatant, moving into attack range.

    In the battle AI, you can e.g. use the Check Move AI Detection node to see if a target is detected by the move AI.

    Also, AI controlled combatants will fall back to their base attack if none of the added battle AIs find an action, so it's a good idea to add a battle AI that uses the None action as the last battle AI.
  • edited August 18
    Hi GIL,

    I did it as per your advise, but something strange happened.

    Combatant sometimes spin at a waypoint for a while before walk to the next waypoint ( if player NOT within detection range ).

    Another problem is If player get into the detection range, the combatant will stop moving, change to Idle forever ( player is within detection range but not yet catch by the raycast ).
    And the combatant will start moving again once Player ran away until out of the detection range.
    But what I need is that the combatant keep walking to the waypoint even Player is within detection range. Is this possible? How?

    However, move ai Hunting works fine if the combatant raycast catch the player.

    Thank you in advance for your help.
    Post edited by bomobee on
  • I'd recommend using the Auto Stop settings to counter this behaviour, especially when using the Default move component (which is very simple and only to get you started).

    The combatant shouldn't stop when the player comes into detection range, it should only change to hunting when the player was detected - I'll look into that.
  • I have used the Auto Stop Settings as well since before I open this discussion.

    I tested again using the same settings for move ai, battle ai, combatant settings and etc., but only changed another prefab in (of another combatant).
    Now it gave me a different result.

    This time with all same settings but just only changed prefab as stated above.
    When player ran into the combatant detection range, the combatant wont stop but suddenly change its path from current waypoint to another. Once it reached the waypoint, it stand there in Idle forever (player is still behind the wall at this point).

    Then even player ran out of detection range and run back in, the combatant still stand there no change (player still behind wall), only if player ran in to its sight and detected by raycast (because now player is in front of the wall and combatant can see by its sight), the combatant started hunting.

    I'm confused if I did anything wrong in the settings or not.
    The two combatants have only one thing different, the Animator.

    I am still trying to figure out what's the cause.

    Thanks a lot for your time and help.
  • edited August 20
    Hi GIL,

    Sorry for disturbing again.

    I tested on different scenes, and different navmesh bakes, gave different results.

    I Tested two combatants in another scenes.
    First combatant who usually stop movement until player ran out of detection range.
    But in this new scene, it stop movement forever, even player stand in front colliding with it, nothing happened.

    Second combatant who will change to another waypoint if player firstly ran in to detection range, and stand idle at waypoint forever except player was detect by racast then start hunting.
    In new scene it start walking immediatly to somewhere (without any waypoint settings for it) until collide with an object but still walk even can't move since stuck at that object in front of it.
    Also even player stand in front of the combatant colliding with it, but no attack, no hunting, keep walking like that forever ( the move AI of this combatant show as Waypoint Mode) or sometimes jut stop and change to be Idle mode forever.

    I baked new navmesh for this new scene also caused different results.
    Sometimes it caused two of this combatants just stand idle at spawn point forever since start the scene ( the move AI mode is Idle at start ).

    Is this may caused from Navmesh?
    I am confused.
    Please advise something would be appreciated.
    Post edited by bomobee on
  • I did some tests and worked fine here.

    Check your range settings in Battle System > Battle Settings, e.g. the Move AI Range.
    Also, check the move AI settings in your used battle system (e.g. for real time in Battle System > Real Time Battles).
  • Thanks a lot GIL, I will test it out if it would work or not.
  • edited August 22
    I changed settings, expecially decreased the range in both settings as per your advice.
    Now if player in detection range the combatant sometimes Idle, walk, change waypoint.
    And a few seconds, it detected player behind the wall.

    I am not sure what is the cause.
    I may stop using raycast for this project.
    But planning to use it for sure in future project.
    Since I want player to hind in a cabinet or wardrobe and combatant can't detect player and walk passes by.

    Thanks for your great support.
    Post edited by bomobee on
  • I didn't meant you should decrease the range - when combatants are out of range, they wont use the move AI, i.e. you should make sure the combatants are within range to the player :)

    As said, it works fine on my end, I'd need a small Unity test project to check things out with your setup.

    In regards to raycasts, I'd strongly recommend using the child options to have a child object as origin and target of the raycast. Otherwise, the raycasts will (usually) be made from the user's feet to the target's feet, which might not be what you want.
  • edited August 25
    I tested it using child objects already last week but not any difference.
    However, I will try to test it again using child object for both Origin and Target in hope that I find something new or the cause of the strange result.

    Actually, I've been using, learning and testing Ork Framework for quite of time, almost everything I have done quite nice according to my need reading all information form Ork Forum.
    However, it seems now only the raycast that is still giving strange result and caused me confusion.

    Is it possible that you send me the ork project that you already set up the Raycast to work properly?
    It would be the easiest and quickest way for me see and learn it in action from your pre-setup project.
    Post edited by bomobee on
  • edited August 28
    There isn't much to set up actually - just enabling Use Raycast in the move detection that should use raycasting, selecting the layers that can be hit by the raycast (i.e. the combatants and all game objects that should block the raycast have to be on one of the enabled layers) and optionally using child objects.

    The most crucial part is the layer mask, since you wont be able to block the view if the blocking object isn't considered by the raycast :)
    Post edited by gamingislove on
  • Thanks GIL, I will give it a try.
    If still fail, i will wait until the 2nd project may be early of next year.
    I will try it again in newly created project then.
    If still not success I will try to send you my project for your testing then.

    Thanks a lot for your help.
Sign In or Register to comment.