News Forums Troubleshooting Parallel animation and move not working with waypoint networks (prob my fault!)

This topic contains 4 replies, has 2 voices, and was last updated by  prime 4 months, 1 week ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #32852

    tapticc
    Participant

    Hi, I am having trouble using a waypoint network and animating using a mecanim parameter for speed which increases over time, rather than jumping from zero to one.

    Basically my “Nerd” is supposed to move near to one of the network points in a random path. This works fine. The Nerd is also animated by setting a mecanim parameter to 1 with a damp time. I can’t get the damp time to trigger multiple times in the tree even though I am using a parallel action. If I set the animation speed to repeat the move only fires once so the smooth acceleration works but the character stands still. Am I using the wrong approach entirely?

    • This topic was modified 4 months, 2 weeks ago by  tapticc.
    • This topic was modified 4 months, 2 weeks ago by  tapticc.
    #32855

    tapticc
    Participant

    I have no idea why the links to screen shots, xml and .cs file are not showing by the way!

    #32856

    tapticc
    Participant

    <behaviortree version=”1.1″ repeatuntil=”” name=”NerdBehaviour”>

    <parallel tiebreaker=”fail” succeed=”all” repeatuntil=”” name=”parallel” fail=”any”>

    <action repeatuntil=”” parametervalues=”” parameters=”” namespace=”(global)” name=”Set Next Wander Location” classname=”WanderLocation” />

    <waypointpath waypointsetvariable=”"Wander"” waypointactiontype=”path” traversetype=”pingpong” traverseorder=”forward” repeatuntil=”” pathtargetvariable=”nextPathStop” name=”waypointpath” movetargetvariable=”nextMoveStop”>

    <parallel tiebreaker=”fail” succeed=”all” repeatuntil=”” name=”parallel” fail=”any”>

    <mecparam valueexpression=”1″ repeatuntil=”” parametertype=”float” parametername=”AnimSpeed” name=”Set AnimSpeed to 1″ damptime=”0.5″ />

    <move turnspeed=”” repeatuntil=”” name=”Move to next stop” movetarget=”nextMoveStop” movespeed=”1″ facetarget=”nextMoveStop” closeenoughdistance=”” closeenoughangle=”” />

    </parallel>
    </waypointpath>
    </parallel>
    </behaviortree>

    #32857

    tapticc
    Participant

    WanderLocation.cs

    using UnityEngine;
    using System.Collections;
    using System.Collections.Generic;
    using RAIN.Core;
    using RAIN.Action;
    using RAIN.Navigation;
    using RAIN.Navigation.Graph;

    [RAINAction]
    public class WanderLocation : RAINAction
    {
    private static float _time = 0;

    public WanderLocation()
    {
    actionName = “WanderLocation”;
    }

    public override void Start(AI ai)
    {
    base.Start(ai);

    _time += Time.time;
    }

    public override ActionResult Execute(AI ai)
    {
    Vector3 loc = Vector3.zero;
    List<RAINNavigationGraph> found = new List<RAINNavigationGraph>();

    do {
    loc = new Vector3(ai.Kinematic.Position.x + Random.Range (-3f,3f),
    ai.Kinematic.Position.y,
    ai.Kinematic.Position.z + Random.Range (-3f,3f));

    found = NavigationManager.Instance.GraphsForPoints (ai.Kinematic.Position,
    loc,
    ai.Motor.StepUpHeight,
    NavigationManager.GraphType.Navmesh,
    ((BasicNavigator)ai.Navigator).GraphTags);

    } while ((Vector3.Distance (ai.Kinematic.Position,loc) < 2f) || (found.Count == 0));

    ai.WorkingMemory.SetItem<Vector3>(“nextPathStop”,loc);
    Debug.Log (loc);

    if (_time > 500f)
    {
    ai.WorkingMemory.SetItem (“isSearching”,false);
    _time = 0f;
    }

    return ActionResult.SUCCESS;
    }

    public override void Stop(AI ai)
    {
    base.Stop(ai);
    }
    }

    #32906

    prime
    Keymaster

    Not sure I can tell what’s up without seeing a bit more. If you have a way to share a sample project, that’s usually most helpful.

    RAIN 2.1 supports damping of speed directly in the Mecanim Motor. So, you could just set the damping there and then use a Move node directly.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.