News Forums Search Search Results for 'freeze'

Viewing 15 results - 1 through 15 (of 36 total)
  • Author
    Search Results
  • #39609

    Sigil
    Keymaster

    I am guessing (I can’t look at the video at the moment), but I believe there is a custom action used in that tutorial which either uses a while loop or a do while loop. It may be one for choosing a random target or location, I can’t recall exactly. Anyhow, I believe that custom action is the culprit, and if you post the code here I can help you fix it.

    What happens is that the loop can’t find a random target and ends up running forever, which freezes up Unity.


    vrgamedevgirl
    Participant

    I have been having this issues and couldn’t figure out what was causing it till i made a simple scene and just kept disabling things. I got to the point where when the AI is enabled on the NPC and I touch the npc with my fps character, the game with just crash/freeze…(On play in editor, and on built mode) I have to end the process and restart unity. When I disable the AI its fine and game does not crash.

    I followed a tutorial for setting up my AI so I have no idea what is wrong. Any ideas??
    The behavior tree i used is in this tutorial. I followed this to the T and it works great, but not if the NPC/enemy gets up in my face. And its a Zombie…. So…

    BasicStart_02
    BasicStart_01

    #39531

    kilfeather94
    Participant

    Sorry for such a late reply to this thread, but just wanted to know if there’s any way of fixing this other issue I had where the enemy character walks into walls? It follows it’s patrol route fine as well as the waypoint network when wandering, but sometimes, when wandering he might get caught in between walls and will keep trying to move through them without navigating around them. Unity then freezes up after a few seconds when the character gets stuck in the walls.

    #38925

    Joshichimaru3
    Participant

    I’m having a few issues with my current AI Behavior and was seeking any possible solutions to these issues. I’d like to note I have a a Time restraint of three full in days which I have to solve these issues by and in my desperation have come to seek some advice from other Developers.

    EDIT: http://s000.tinyupload.com/index.php?file_id=57724855371754559402
    this is the current behavior tree I’m using if you were unsure how each node worked.

    Below is an image of the behavior tree my problems will be relating to.
    My AI
    Below is an image of the Navmesh
    The Navmesh

    The first issue is when I walk into a room with a door. When I enter a room and my AI is chasing the player, the rain behavior will not show any state active (no nodes coloured in the debugging) untill it finally stops where he will continue his patrol route or pursue the player., and I will hear a sound similar to when a program crashes (the start of a sound looping). I assume this is caused by the ai jumping in between states and its due to the colliders or the ai being unable to see the player the moment he moves. I’ve tried enlarging the colliders on the doors to ensure there are no gaps although the issue still resides. I later discovered that he can occasionally do this around corners as well so I’m sure its due to the way U;ve build the behavior tree. Optimally id like the ai to do a set animation and just wait for the player until LOS is broken. Additionally I considered a short idle state to wait if the player appears before continuing to resume his patrol rounds although I’m struggling to understand the Behavior system rain uses and have made a few attempts but all resulted in my current behavior breaking.

    The second issue is when the AI gets to the edge of the Navmesh and the player is visible but to far away for him to reach, the ai will just freeze and sit there as one of the nodes returns fail and it becomes stuck in an infinite loop. I’m really struggling to wrap my head around the logic these behavior trees use, and I’m not sure how I can combat these issues.

    I’ve rebuild my behavior tree multiple times and the current version I shared above so far is the most optimal. I’ve read through a few posts over the past 10 weeks and looked a few tutorials but I struggle to understand how to hiearch and build these behavior trees in an optimal. I know the issue is the way I’ve build the Behavior Tree but I’ve tried a variety of builds and just can’t seem to get it right.

    Any solutions or suggestions would be a huge help!

    • This topic was modified 6 months, 1 week ago by  Joshichimaru3.

    Sacristan
    Participant

    Hi!

    Ill try to explain my problem briefly.

    1. Ive a terrain which is consisting of Chunk (GameObject)with a mesh that holds a set of blocks, what basically is a lowest unit in terrain. Those blocks can be created and destroyed at runtime. This terrain is generated at runtime and blocks can be edited at runtime.
    Image

    As You can probably see - ive added a Convex mesh collider, but it seems that convex wont do the thing here.

    Here i have the same chunk with meshcollider, but its not convex anymore. Ive emphasized two blocks with cycles.

    2. This terrain uses custom Physics and with all that - no Unity raycast support (custom intersection logic / raycasts). For example, Player and AIs use custom character controller;

    3. As Terrain is generated at runtime and can be updated at runtime (each chunk can be changed in realtime) - AFAIK there is no way to actually use RAIN Navmesh for navigation (runtime navmesh gen is not an option because on terrain create it will work, but at runtime chunk updates it would freeze the game as Navmeshes should be re-generated);
    For example, i want to suddenly create a hole - AI should be immediately be aware of that and avoid it.

    4. This Meshcollider that im adding to each chunk is a unused feature - its added specially for RAIN (currently it uses memory for no reason - if there is a way to not use it - i would love it and remove it);

    What i have done so far?

    1. Added CustomCharacterMotor and managed to use the custom CharacterController that this VoxelEngine uses. See code here -> http://hastebin.com/oludobejak.avrasm
    Movement is working fine.
    2. Added Custom Navigator, but havent got any functionality working - thats why i am writing here. Current version: http://hastebin.com/poxinirofi.cs

    I would love to somehow get AIs to be aware of current Terrain(the same layer where they are)
    do i need to create custom pathfinding or somehow register my blocks (they are not gameObjects) for RAIN as obstacles or somehow build a navmesh-like mesh for each chunk that AI uses for pathfinding ?

    Any ideas? Sigil, perhaps You can help me out with this.

    Please dont hesitate to ask more questions or correct me regarding this problem. I need to lauch this game ASAP.

    Best regards,
    Sacristan

    • This topic was modified 6 months, 2 weeks ago by  Sacristan.

    JensenFang
    Participant

    So I am using RAIN AI to set up my enemy AI behaviour:
    Enemies will patrol in a specific route, and keep detect player, once the player is found,
    they will start to follow player and try to attack when get close enough.

    And here is my problem when I test it:
    Each enemy will start to follow player which is ok but, instead of avoid each other’s path
    and pathfinding a new way to get to the player, they just block each other, and the blocked
    enemies just keep going in the wrong direction and could not find a new way…

    Here are what I did so far:
    1 Navgation Mesh added.
    2 Enemy using CapsuleCollider and Rigidbody with rotation freezed, and using BasicMotor.
    3 Using “Move” Node in the BehaviourTree to move to the player when detect.
    4 Using EntityRig to set up the player to make it detectable.

    #38327

    TonyV125
    Participant

    I realize this post is a few months old, but I started having this same issue after I started implementing a navigation mesh. Also note that I’m not using any “Facing Target” in my move nodes. I’m using RAIN 2.1.11.0 and Unity 5.1.1f1 (also saw the same behavior in 5.0.3).

    Initially, I was only using a Waypoint Network and my AI characters followed the paths as expected. After adding a Navigation Mesh, there are now multiple locations along the path that the AI characters travel that causes them to freeze, and it’s not at all like what happens if they run into an obstacle.

    The only thing that causes these frozen characters to come out of their catatonic state is if an entity that they are instructed to move towards ends up within their sensor. Remove the entity and they go back to following their route with no further issues unless they hit another one of these bad locations.

    Since it only happens when the Navigation Mesh is active, I’m guessing it has more to do with the mesh, BUTnone of this freezing behavior occurs if I use a Waypoint Route and the same Navigation Mesh. I’ll keep experimenting with it, but I thought I’d check to see if anyone else has seen this and possibly found what causes it.

    Thanks

    #36937

    CodersExpo
    Participant

    How does this new parenting stuff work?

    Also; I can’t recall because I have been doing it this way for so long now, we have to add a rigidbody. Gravity should be selected and freeze rotation x and z checked for the character to walk over rough terrain, correct?

    I want the character to ’tilt’ going up an incline. So, I deselect the freeze rotations. I chedck ‘Allow 3DRotation’ and he looks ok for a bit, then rotates out of control occasionally. This is not a RAIN issue though…I don’t believe. Please correct me if I’m doing something wrong. I’ve been away for awhile

    • This reply was modified 11 months ago by  CodersExpo.
    • This reply was modified 11 months ago by  CodersExpo.
    • This reply was modified 11 months ago by  CodersExpo.

    Stiffer
    Participant

    Hey all!
    I’ve never introduced myself properly here so let’s begin with that.
    I’m Stiffer, an Indie developer from Sweden. (so pardon my language skills…)
    Have no clue what I should tell about myself… so lets get into the real stuff…

    So, let me try to explain this as detailed as possible…
    I have a project I’ve been working on for some time, and I’ve been using RAIN AI the whole time.
    I had my monsters AI set up and Patrol-route set up with a nav-mesh and nav-targets.
    After i saw that the basics of the monster worked, I focused on other stuff for a time.

    A few days ago I checked back on my monster, saw that RAIN had updates (2.1.10) from god knows what.

    So I downloaded the update from the website and imported it right on top of the old one… without thinking(facepalm)…
    It still worked tough… so I kinda felt like it was ok so save the project and keep up my work.
    The problem started when I removed the old nav-mesh, since I needed a bigger one…
    I add a navmesh, choose to see gridlines so I can set it up properly, then I press Generate and Unity freezes for a few seconds.
    After this I get an error message and no navmesh, even if I choose to see the navmesh.
    (The error code is further down)

    I feel like I’ve tried everything now, without any luck…
    I tried just removing RAIN AI from the project to install it anew…. no change.
    I tried restart Unity…no luck.
    I tried without the AI folder too…no luck…
    I tried all three above in every thinkable combination, no luck.

    So I tought… hey, let’s try with a new project… tried that, installed Rain AI, generated a navmesh… success…

    Created a new project, imported everything from my project (nothing with RAIN tough)… installed Rain AI, generated a nav-mesh… ERROR… same error…

    my question is, can I bypass this error or do I have to create a whole new project, using no prefabs, only import the basics of my real project and go from there? (maybe I’m missing something obvious here too)…

    The error:

    Object reference not set to an instance of an object
    at RAIN.Navigation.NavMesh.Collectors.TerrainColliderCollector.InitCollector (Single aCellSize, Single aMaxSlope, System.Collections.Generic.List`1 aUnwalkableTags, System.Collections.Generic.List`1 aIgnoredTags, LayerMask aIncludedLayers) [0x00000] in <filename unknown>:0
    at RAIN.Navigation.NavMesh.RecastProcess.ContourCreator..ctor (Bounds aBounds, LayerMask aIncludedLayers, System.Collections.Generic.List`1 aIgnoredTags, System.Collections.Generic.List`1 aUnwalkableTags, Single aMaxSlope, Single aCellSize, Int32 aGridSize, Single aBorderSize, Single aWalkableHeight, Single aWalkableRadius, Single aUnwalkableRadius, Single aStepHeight, Single aMinRegionArea, Single aMergeRegionArea, Single aMaxVertexError, Single aMaxSegmentLength, Int32 aThreadCount) [0x00000] in <filename unknown>:0
    at RAIN.Navigation.NavMesh.NavMesh.StartCreatingContours (Vector3 aPosition, Vector3 aScale, Int32 aThreadCount) [0x00000] in <filename unknown>:0
    at RAIN.Navigation.NavMesh.NavMesh.StartCreatingContours (RAIN.Core.RAINComponent aComponent, Int32 aThreadCount) [0x00000] in <filename unknown>:0
    at RAINEditor.Navigation.NavMesh.NavMeshEditor.DrawInspector (System.String aLabel, RAIN.Serialization.FieldWalkerList aWalker) [0x00000] in <filename unknown>:0
    at RAINEditor.TypeEditors.RAINTypeEditor.DrawFieldForInspector (RAINEditor.Core.RAINComponentEditor aComponentEditor, System.String aLabel, RAIN.Serialization.FieldWalkerList aWalker) [0x00000] in <filename unknown>:0
    at RAINEditor.TypeEditors.RAINTypeEditor.DrawFieldForInspector (RAINEditor.Core.RAINComponentEditor aEditor, RAIN.Serialization.FieldWalkerList aWalker) [0x00000] in <filename unknown>:0
    at RAINEditor.Navigation.NavMesh.NavMeshRigEditor.DrawComponentForInspector (RAIN.Serialization.FieldWalkerList aWalker) [0x00000] in <filename unknown>:0
    at RAINEditor.Core.RAINComponentEditor.OnInspectorGUI () [0x00000] in <filename unknown>:0
    UnityEngine.Debug:LogError(Object)
    RAINEditor.Core.RAINComponentEditor:OnInspectorGUI()
    UnityEditor.DockArea:OnGUI()

    #36132

    jlejoux
    Participant

    Hi !

    I have an infinite terrain which is generated at runtime in my scene.
    Currently I’m using rain without navmesh but this doesn’t work really well as there are a lot of trees/rocks in my scene.

    What would my options be ?

    * Generate navmesh at runtime ? The problem here is that I will always be generating navmeshs and this might be freezy for the game.

    * Limit my map size (last option for me as I really wanted it to be infinite) ? But still the map has to be large and so I could generate navmeshs during the generation but then the generation part at the begining of the game would take a minute

    * Compute a defined navmesh size around the player (let’s say 300*300) and recompute it when the player moved from 50-100 sideway ? will this freeze during the game if I compute it using multithreading ?

    EDIT: When I tried to generate multiple navmeshs (on per chunk) on the infinite terrain I used the code given in the wiki. Does this code implements multithreading ? If no maybe that would be a solution right ?

    thx !

    • This topic was modified 1 year ago by  jlejoux.
    • This topic was modified 1 year ago by  jlejoux.
    #35839

    tool55
    Participant

    Got ya. The script I’m using does have a gravitational force. I tried it with full physics at one point several months ago, but quickly realized it wouldn’t work well with RAIN, or with any non-physics character controller for that matter. I think the script I’m using for rotating the model isn’t ideal. It uses four raycasts from the corners of the insect and vector math to calculate the average normal, then a Lerp to smooth the rotation. But I don’t claim to fully understand how to optimize it. I took it from one of the many posts I read on the subject and modified it a bit (probably not very well). It was designed to work with a character controller, but I commented out those parts. I’ll post it below in case it’s useful to anyone else, or if someone has ideas about how to simplify/optimize it for RAIN. It’s in Javascript. Thanks very much for your help, Prime.

    #pragma strict
    var moveSpeed: float = 6; // move speed
    var turnSpeed: float = 90; // turning speed (degrees/second)
    var lerpSpeed: float = 10; // smoothing speed
    var gravity: float = 10; // gravity acceleration
    var isGrounded: boolean;
    var deltaGround: float = 0.2; // character is grounded up to this distance
    var jumpSpeed: float = 10; // vertical jump initial speed
    var jumpRange: float = 10; // range to detect target wall
    var bugParent:Transform;
    var backLeft:Transform;
    var backRight:Transform;
    var frontLeft:Transform;
    var frontRight:Transform;
    private var lr:RaycastHit;
    private var rr:RaycastHit;
    private var lf:RaycastHit;
    private var rf:RaycastHit;
    private var surfaceNormal: Vector3; // current surface normal
    private var myNormal: Vector3; // character normal
    private var distGround: float; // distance from character position to ground
    private var jumping = false; // flag "I'm jumping to wall"
    private var vertSpeed: float = 0; // vertical jump current speed 
    private var bugCollider:CapsuleCollider;
    function Start(){
        myNormal = transform.up; // normal starts as character up direction 
        rigidbody.freezeRotation = true; // disable physics rotation
        // distance from transform.position to ground
        bugCollider = GetComponent(CapsuleCollider);
        distGround = bugCollider.bounds.extents.y - bugCollider.center.y;
    }
    function FixedUpdate(){
     Physics.Raycast(backLeft.position + Vector3.up, Vector3.down, lr);
    			    Physics.Raycast(backRight.position + Vector3.up, Vector3.down, rr);
    			    Physics.Raycast(frontLeft.position + Vector3.up, Vector3.down, lf);
    			    Physics.Raycast(frontRight.position + Vector3.up, Vector3.down, rf);
    			    surfaceNormal = (Vector3.Cross(rr.point - Vector3.up, lr.point - Vector3.up) +
    			                	         Vector3.Cross(lr.point - Vector3.up, lf.point - Vector3.up) +
    			               	             Vector3.Cross(lf.point - Vector3.up, rf.point - Vector3.up) +
    			               	             Vector3.Cross(rf.point - Vector3.up, rr.point - Vector3.up)).normalized;
        // apply constant weight force according to character normal:
        rigidbody.AddForce(-gravity*rigidbody.mass*myNormal);
        myNormal = Vector3.Lerp(myNormal, surfaceNormal, lerpSpeed*Time.deltaTime);
        // find forward direction with new myNormal:
        var myForward = Vector3.Cross(bugParent.right, myNormal);
        // align character to the new myNormal while keeping the forward direction:
        var targetRot = Quaternion.LookRotation(myForward, myNormal);
        transform.rotation = Quaternion.Lerp(transform.rotation, targetRot, lerpSpeed*Time.deltaTime);
        transform.position.x = bugParent.position.x;
        transform.position.z = bugParent.position.z;
        // move the character forth/back with Vertical axis:
        //transform.Translate(0, 0, Input.GetAxis("Vertical")*moveSpeed*Time.deltaTime); 
    }
    #35331

    ARRCOMM
    Participant

    Remember to set the character Rigidbody to Gravity, NOT Kinematic, along with the Constraints (under the RigidBody component) as already stated ( Freeze Position X, Z and Freeze Rotation X, Y, Z ). Be sure put that Capsule Collider on your person. If your AI is a box, you probably need the standard Box Collider.

    #34712

    prime
    Keymaster

    Set constraints on the rigid body - freeze in X/Y/Z rotation and X/Z position

    #34331

    Sigil
    Keymaster

    Alright, I think the problem is outside of that exception (although I wouldn’t mind seeing the log for any other exceptions in the event that it is something from our editor causing the problem).

    So the top parallel there is probably the issue. A parallel is somewhat special since it runs all of its nodes simultaneously. It means it could have one child return success, one return failure, and one return running, or any combination of that. Because of that there are a couple options for when a parallel will stop running and what it will return. By default I believe it is set to return failure if any child fails, and success if all children succeed.

    In your case, you have two nodes returning running (repeating forever), and one node returning success, at least at the time it freezes up. So no child failed, but only one child succeeded. So the parallel is now waiting for the other two children to either succeed or fail, which they won’t, because they are repeating forever. In your case this is easy to fix, set the parallel to return success if any children succeed (in the properties of the parallel). The tie breaker doesn’t matter since your tree doesn’t care what the parallel actually returns.

    TL;DR: Set the Succeed option to Any on the top Parallel.

    #33992

    Jsmucker
    Participant

    I must be screwing up somewhere, sorry, I am just not getting this to work. The enemy freezes and doesn’t “chase” the player. I have the move command in a parallel with the sequencer and have tried replacing the player !=null and keeping both.It would just be easier to upload a picture so you can see what I am doing wrong. How do I do that without having to post a URL?

Viewing 15 results - 1 through 15 (of 36 total)