i want to make an ai bird that fly randomly . tried to do it with ai move to but failed , any help.
try to use “move to location” node ,it allows you to move the birds in the air,and doesn’t need a navmesh.
And use “random unit vactor” to generate a random direction,then use that direction to fire a line trace(also a random length in a wanted range).and then if it hit something means that the the location is on the ground,we need to regenerate new location again. only when the line trace has hit nothing,we can use the line trace’s end location for the target location.
i think in my map its impossible for it to not hit anything with the line trace , because my map is have a roof but its very high . i don’t know mush about line trace if it keep going till it hit something even if its far then it wont work but i will give it a try.
"move to location "So i use the move to location or actor node.
so i use a random unit vector in a line trace by channel in the start of the line trace.
so what to put in the “end” of the line trace so it doesn’t hit the roof?
sol i break hit the result , get a branch connect it to the blocking hit if it was true i repeat, if false i take the trace end set it to variable , use it as as the "move to location or actor " node goal
is this what i need to do?
I made an quick example for you to reference ,
First the bird should be a pawn,create it with a pawn and then add a “floating movement component ” to it.
at the bird’s begin play;
the move event:
the custom function:
thanks,
also i really like the comments you did in the bp it explains alot. thanks
I realize that the custom function has a critical issue.if the bird accidentally goes to a narrow place.it won’t able to find a location.the function will run infinitely.might crash the game.
here are some modified BPs.
begin play
In the function
move event
thanks, I just saw that. I really appreciate that.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.