|
Hello all, I have a game that is using "canyon racer" scenario. Essentially vehicles are racing through valleys to get to checkpoints. After a player has reached all the checkpoints a lap will have been completed. I am using UnitySteer and AngryAnt's path to provide the AI. Everything is working great except for two issues: the first is that once the vehicle has completed the first lap, he is "turned loose" from path and just flies in a straight line (eventually blowing up). What I need is an event that will tell me when my vehicle has completed the path given to it, so that it can cycle to the next destination and continue on through the race until all the laps have been completed. The second issue is that have no idea how to setup the "pathfollower" vehicle in unitysteer, to better avoid obstacles or adhere to the path. I see the "weights" and have messed around with them (I don't know what the max/min values should be, I assume 0-1). I can tell a difference with the "pathFollowWeight" but not with the "obstacleAvoidanceWeight". I am using a slightly modified version of the script given here: http://answers.unity3d.com/questions/254/unitysteer-and-path only without the use of the "IRadarReceiver" (it was causing to many compile errors, and i don't know how to implement it correctly). Any help would be greatly appreciated, even if it is just a link that will point me in the right direction. Thanks!
(comments are locked)
|
Is it possible that you have StopOnArrival set to false?
I'd recommend declaring your own event, adding a delegate on the MonoBehavior which registers to it, then invoking them here. You'll see the vehicle is really simple, it should be easy to extend.
Regarding obstacle avoidance, the PathFollower does a very basic one. You may of course want to tweak it, as it got only rudimentary testing. It also bears saying that better avoidance will depend entirely on your scenario. The three major parameters are:
The values are multipliers clamped between 0 and float.MaxValue, so you could (for instance) set ObstacleAvoidance on 0.5f, NeighborAvoidance on 1 and PathFollow on 1.5f. As you can see on the lines preceding this one, the multipliers are then used before the steering force is applied. Thank you for your help. the weight system makes much more sense now. I was able to get the event handler working and can now fire off code once the path has been completed. I tried setting the "StopOnArrival" both ways and it makes no difference. After the path is completed, i call "goto( destination )" (to try and restart the lap) and i just get hit with "onsearchFailed". So I have no clue how to keep the ship making laps around the track. thanks again for your help.
Mar 19 '10 at 02:44 AM
n8
It'll be difficult to help with that without seeing your code. If you can post a sample project somewhere, I'd be glad to take a look at it.
Mar 19 '10 at 09:03 AM
Ricardo
(comments are locked)
|
|
ok so i finally found the answer to my question about how to keep my ship making laps around the track. There is a line where you instantiate the "AngryAntPathway" object, and pass in the constructer's parmeters. the last parameter passed is for the "cyclic" option. This has been set to "false" (i didn't initially even know this existed), once I set it to "true" my ship will effortlessly make laps around the track! Here is the script that I have been using:
} Please keep in mind that this script is in a "just get things working" state. There is a lot of code that could (and should) easily removed.
Mar 21 '10 at 10:25 PM
n8
Good to hear, I hadn't thought to bring that up. Cheers!
Mar 21 '10 at 10:49 PM
Ricardo
Getting this Error: Assets/_AI/AiControl.cs(3,7): error CS0246: The type or namespace name `PathLibrary' could not be found. Are you missing a using directive or an assembly reference? Is there something I'm missing? What are requirements to run this code? What should be imported into project and where? Also this code should be placed on object which should be controled? Any others scripts should be attached? Thank you.
Dec 20 '10 at 11:33 PM
cupsster
I'm getting the same error and cupsster. Also, what does ISearchMonitor look like?
Nov 02 '11 at 01:37 PM
asumsky
(comments are locked)
|
