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.
-
AuthorPosts
-
November 28, 2022 at 2:54 pm #5678
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.zipNovember 28, 2022 at 3:31 pm #5682Thanks 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.
November 29, 2022 at 2:00 am #5687I’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?
November 29, 2022 at 8:02 am #5688November 29, 2022 at 8:04 am #5689It is just an user preference. The following links have some information about AStarPathfinding features.
http://arongranberg.com/astar/freevspro
http://arongranberg.com/astar/featuresDecember 9, 2022 at 3:29 am #5805However, the MecanimMotor input of the parameter “AngularSpeed” is jittered when using the AStarPathfinding. Any Rain developer can help ?
December 9, 2022 at 6:30 pm #5810Try using a close enough angle of 20 or more.
December 18, 2022 at 9:18 am #5955I 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” ?December 18, 2022 at 2:40 pm #5957Sure.
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.
December 19, 2022 at 2:49 am #5983using Rain 2.0.7 with MecanimMotor with the following setting
Speed = 1, RotationSpeed = 180, CloseEnoughDistance = 0.1, CloseEnoughAngle = 10, FaceBeforeMoveAngle = 10The 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.pngDecember 19, 2022 at 3:12 am #5984After further trying, Speed = 1, RotationSpeed = 90, CloseEnoughDistance = 0.1, CloseEnoughAngle = 20, FaceBeforeMoveAngle = 20 is more stable now.
December 23, 2022 at 9:35 am #6046set 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?
January 2, 2023 at 5:39 am #6089set 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?
January 2, 2023 at 3:22 pm #6095The 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.
January 6, 2023 at 4:41 pm #6160For 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 ?
-
AuthorPosts
You must be logged in to reply to this topic.