Forum Replies Created

Viewing 15 posts - 406 through 420 (of 605 total)
  • Author
    Posts
  • in reply to: Problem with constraint #38603

    Sigil
    Keymaster

    Let me do some tests to see if we are handling destroyed GameObjects correctly, assuming you are calling Destroy on the GameObject.

    While I do that, could you post a screenshot of the behavior tree editor while this tree is running? In particular when it is not working correctly so that I can see all the return values in the tree.

    in reply to: AI overriding physics in character controller #38602

    Sigil
    Keymaster

    I’m not sure what you mean by “redeclared” the AI’s body, do you mean you reassigned it in the editor, or are you giving it a new value in a script when playing. Also the AI only looks at the Body for a Character Controller, it won’t go any further in the hierarchy.

    in reply to: Activating or Deactivating Entity Aspect (is active bool) #38597

    Sigil
    Keymaster

    Try this:

    EntityRig tRig = gameObject.GetComponentInChildren<EntityRig>();
    tRig.Entity.GetAspect("MyAspect").IsActive = false;
    in reply to: Root motion doesn't "walk" #38596

    Sigil
    Keymaster

    Perhaps the clip accidentally included too many frames. You can adjust the length of the clip in the import settings and that might fix it. The animation importer gives some indicators for looping (green, yellow, red) and a little bit of a graph when you adjust the start and end times to help you loop it.

    in reply to: Avoiding collision with dinamic obstacles? #38595

    Sigil
    Keymaster

    Not currently, agent/dynamic avoidance is still an upcoming feature for RAIN/Sentio.

    in reply to: AI overriding physics in character controller #38594

    Sigil
    Keymaster

    Make sure that if you are using a Character Controller you have the Character Controller Motor selected on the motor tab of the AI (this will go away shortly but it’s still necessary now). If using a Collider plus Rigid Body you should use the Basic Motor. If you are using the Mecanim Motor it will work with either.

    in reply to: Root motion doesn't "walk" #38584

    Sigil
    Keymaster

    Let’s make sure the root motion is working appropriately. Try this out:

    • Drop your character on a plane in an empty scene, remove any AI on it
    • Create a Controller and put just the walk animation in there, make sure it is the default state
    • Assign the controller to the character’s Animator and make sure root motion is on it
    • Press play

    You should see the model move on its own at this point. Assuming that works, only the following is necessary (in the simplest setup): Animator with root motion on, AI with Mecanim Motor and Use Root Motion on, AI with Mecanim Animator.

    in reply to: Spawn Pool #38580

    Sigil
    Keymaster

    In retrospect, this is what it looked like with the old spawner:

    So this was definitely a much needed change to the spawner, and will be in the next version for sure. Now lets see if we can hunt down where your lag is coming from.

    in reply to: look rotation viewing vector is zero #38579

    Sigil
    Keymaster

    As it goes, we do check for zero length viewing vectors, in several places. I think a couple exceptions may be if there is 3D rotation or movement, in which case going straight up or down might cause problems.

    I started testing this and I’m actually having a hard time getting it to happen at all. Is there something particular happening at the time the message comes up? Does it happen a lot or a little?

    in reply to: Spawn Pool #38577

    Sigil
    Keymaster

    See if you can run the profiler and see where the lag is coming from. It should be fairly clear as it will suddenly spike. You can also click the spike and see what is running at the time.

    Try turning down the spawn delay as well when looking at the profiler, so that you can see multiple spawns on the profiler window at the same time. This is what mine looks like right now, using the same Squad Command that is on the store, with the new Spawner (set spawn delay to 1 and number of soldiers to 8).

    in reply to: Create BT dynamically #38572

    Sigil
    Keymaster

    Ok, so you have a few routes for creating behavior trees:

    // If you're just loading trees dynamically, this would work
    ((BasicMind)tRig.AI.Mind).SetBehavior(Resources.Load<BTAsset>("PatrolTree"),
                                          new System.Collections.Generic.List<BTAssetBinding>());
    // If you want to create with XML, this would work
    string tXml = @"<behaviortree version=""1.1""
                                  repeatuntil="""" 
                                  name=""Move"" 
                                  debugbreak=""False"">
                        <waypointpatrol waypointsetvariable="""Waypoint Route"""
                                        waypointactiontype=""patrol""
                                        traversetype=""pingpong""
                                        traverseorder=""forward""
                                        repeatuntil=""""
                                        pathtargetvariable=""""
                                        name=""waypointpatrol""
                                        movetargetvariable=""waypointTarget""
                                        debugbreak=""False"">
                            <move turnspeed=""""
                                  repeatuntil="""" 
                                  name=""move""
                                  movetarget=""waypointTarget"" 
                                  movespeed="""" 
                                  facetarget="""" 
                                  debugbreak=""False"" 
                                  closeenoughdistance="""" 
                                  closeenoughangle="""" />
                        </waypointpatrol>
                    </behaviortree>";
    ((BasicMind)tRig.AI.Mind).BehaviorRoot = BTLoader.Load(tXml,
                                                           new System.Collections.Generic.List<BTAssetBinding>());
    // If you just want to programatically create them
    BTWaypointNode tRoot = new BTWaypointNode()
    { 
        waypointSetVariable = ExpressionParser.Parse("Waypoint Route"),
        waypointActionType = BTWaypointNode.WaypointActionType.PATROL,
        traverseType = BTWaypointNode.WaypointTraverseType.PINGPONG,
        traverseOrder = BTWaypointNode.WaypointTraverseOrder.FORWARD,
        moveTargetVariable = "waypointTarget"
    };
    tRoot.AddChild(new MoveAction()
    {
        moveTargetExpression = ExpressionParser.Parse("waypointTarget")
    });
    ((BasicMind)tRig.AI.Mind).BehaviorRoot = tRoot;

    I didn’t run these, just made sure they compiled, but it should be close.

    in reply to: Wait for animation to finish playing #38571

    Sigil
    Keymaster

    Had an additional thought on this, I think my logic is a little wrong, the code should read more like this:

    // If we aren't playing our Death animation yet, or if we are *still* playing it, return running
    if (!tInfo.IsName("Base Layer.DeathOne") || tInfo.normalizeTime < 1)
        return ActionResult.RUNNING;
    // Do my action stuff

    I think that makes more sense, this way it will stay RUNNING until it gets through the death animation vs what I had which may not have worked if you were still in transition to the death when it first hit.

    And thanks for the suggestion, I do think having ways of disabling the tree would be good, especially for testing things out.

    in reply to: How to adjust the shooting accuracy of AI? #38570

    Sigil
    Keymaster

    Well the accuracy in SC represents the amount of error per meter of distance. It probably should be called aim error or accuracy error. So to get a 25% accuracy on a 0.5m wide target at 1m distance you would need to set accuracy to 1. Of course, as your distance increases you’d have to bring that number down (0.1 at 10 meters, 0.01 at 100 meters, etc).

    If the problem is that the AI kills things too fast you may get better results by modifying the gun’s fire rate and base damage. They are located on the GunController class on the M4MB prefab. Also changing the AI’s reaction time on the AimAndFireElement, or the length of time the AI fires their gun in the Common/FireWeapon behavior tree (not sure why it isn’t in the element as well).

    in reply to: rotation problem while walking. #38569

    Sigil
    Keymaster

    Just an additional note. My response is assuming a simple setup of just moving towards a point and the AI appearing sideways. If you are using other behavior tree nodes or have a face target set in your move node, there may be something else going on.

    in reply to: rotation problem while walking. #38568

    Sigil
    Keymaster

    RAIN will use the forward vector of the GameObject to move forward. Sometimes models are exported incorrectly and have an additional 90 degree rotation on them. If it is just the model you may be able to just rotate the skeleton or mesh within the model in Unity.

    Sometimes it can be the animations that are incorrect though, which will cause the model to rotate back even if you change it. If you are using animations with Mecanim you may be able to mess with the import settings to fix this (Root Transform Rotation has an offset on it).

    And above all, if you are the one exporting the model/animations, check the export settings as that is usually the cause of this.

Viewing 15 posts - 406 through 420 (of 605 total)