News Forums RAIN General Discussion and Troubleshooting RAIN 2.0 + 3rd party AStar Pathfinding

This topic contains 37 replies, has 4 voices, and was last updated by  Yuewah Chan 1 year, 9 months ago.

Viewing 15 posts - 1 through 15 (of 38 total)
  • Author
    Posts
  • #5678

    Yuewah Chan
    Participant

    I have integrated AStarPathfinding (http://arongranberg.com/astar/) into RAIN 2.x, I would like to share to the public.

    RAIN 2.0.6.2217 + AStarPathfinding 3.2.5.1 Free + Unity 4.2.x
    https://dl.dropboxusercontent.com/u/9322397/RAIN/RAIN_Mecanim_AStar.zip

    #5682

    prime
    Keymaster

    Thanks for making a start on that @Yuewah Chan. I’ll encourage everyone to share their experiences and code as they work on this. I noticed a few gaps that could cause problems. Putting out a more complete sample of how to integrate 3rd party pathfinding is still on our to do list. We’ll get there as soon as we can.

    Also, please make sure you have the permission of Aron Granberg and other asset providers before redistributing their code, even if it is the free version. I’m not familiar with Aron’s licensing, so you might be fine - I’ll just encourage you to make sure.

    #5687

    vvolynine
    Participant

    I’ve heard lots of good things about AStarPathfinding, is there really that much of a benefit to switching between pathfinding systems or is that totally user preference?

    #5688

    Yuewah Chan
    Participant
    #5689

    Yuewah Chan
    Participant

    It is just an user preference. The following links have some information about AStarPathfinding features.

    http://arongranberg.com/astar/freevspro
    http://arongranberg.com/astar/features

    #5805

    Yuewah Chan
    Participant

    However, the MecanimMotor input of the parameter “AngularSpeed” is jittered when using the AStarPathfinding. Any Rain developer can help ?

    #5810

    prime
    Keymaster

    Try using a close enough angle of 20 or more.

    #5955

    Yuewah Chan
    Participant

    I have tried, it is not always jittered, but if it occurs occasionally while it is turn direction.
    btw, can you explain more about relationship between “rotation speed”, “close enough angle”, “face before move angle” ?

    #5957

    prime
    Keymaster

    Sure.

    Rotation speed is the speed at which the AI will turn (in place) when attempting to move or face an object. 180 indicates 180 degrees per second (i.e., 2 seconds to complete a rotation).

    Close enough angle is the maximum deviation between the AI orientation and the requested facing direction. When the deviation is greater than this amount, the AI will attempt to rotate toward its facing target (or forward moving direction). Once it starts turning, it will attempt to get as close as possible before completing the turn. For example, if close enough angle is 20, then the AI won’t attempt to turn until its angle is more than 20 degrees from its intended angle.

    Face before move angle is the maximum deviation between the AI orientation and the movement direction allowed. This is used to force the AI to turn toward its movement direction before attempting to move. For example, if you want your AI to turn in place to within 90 degrees of its forward movement direction before starting to move, then set the face before move angle to 90. This is often used with human characters to keep them from walking backward while they spin around.

    #5983

    Yuewah Chan
    Participant

    using Rain 2.0.7 with MecanimMotor with the following setting
    Speed = 1, RotationSpeed = 180, CloseEnoughDistance = 0.1, CloseEnoughAngle = 10, FaceBeforeMoveAngle = 10

    The following table show some debug log of mecanim param. The result is that the mecanim animation is jittered.
    https://dl.dropboxusercontent.com/u/9322397/RAIN/Rain_Mecanim_Move.png

    #5984

    Yuewah Chan
    Participant

    After further trying, Speed = 1, RotationSpeed = 90, CloseEnoughDistance = 0.1, CloseEnoughAngle = 20, FaceBeforeMoveAngle = 20 is more stable now.

    #6046

    Yuewah Chan
    Participant

    set CloseEnoughAngle = 20 is not the best solution as “This makes for imprecise movement by the AI, but it gets rid of the jitter” quoted from http://rivaltheory.com/forums/topic/mecanim-animations/. In the same post, prime said “I’ll try to address these in my next example project and video.” , could you tell me how to do ? or what direction should I try?

    #6089

    Yuewah Chan
    Participant

    set CloseEnoughAngle = 20 is not the best solution as “This makes for imprecise movement by the AI, but it gets rid of the jitter” quoted from http://rivaltheory.com/forums/topic/mecanim-animations/. In the same post, prime said “I’ll try to address these in my next example project and video.” , could you tell me how to do ? or what direction should I try?

    #6095

    prime
    Keymaster

    The real problem is that it is nearly impossible to get precise movement when you allow root motion to control direction. There are two ways to deal with it:

    1) Don’t use root motion for rotation. The 2.0.8 patch includes a toggle for using root motion only for linear movement and overriding it for rotation.

    2) Create a custom motor that adds auto-correct for rotation within a range. For this, you might leave your close enough at 20, but then within 20 add a small correction over time so that your AI will keep from drifting within small angles.

    #6160

    Yuewah Chan
    Participant

    For the Default Mecanim Example shipped by Unity, the Locomotion including (Idle, TurnOnSpot, WalkRun, PlantNTurnRight, PlantNTurnLeft ). How can I know if it use root motion for rotation ? If I use choice 1 ( Don’t use root motion for rotation ), what setting i need to take , e.g. Animator.ApplyRootMotion, MecanimMotor.UseRootMotion, MecanimMotor.OverrideRootMotionRotation ?

Viewing 15 posts - 1 through 15 (of 38 total)

You must be logged in to reply to this topic.