|
Post by ejlnmusic on Sept 25, 2018 9:56:52 GMT
Hi guys, weird I know :D but is it possible to constrain enemy to the path just like we can constrain player to the path? NavMesh shortening baking is not an option..unfortunately as it is not precise as path.
|
|
|
Post by shadex on Oct 12, 2018 17:09:03 GMT
Hi guys, weird I know :D but is it possible to constrain enemy to the path just like we can constrain player to the path? NavMesh shortening baking is not an option..unfortunately as it is not precise as path. Couldn't you just lower the sight / hearing / follow / chase distance and use patrol? Should be doable on just about any AI. If you never want the enemy to deviate from the path and never attack, just turn off the senses
|
|
|
Post by ejlnmusic on Oct 13, 2018 17:21:30 GMT
well...i want enemy to move as attached to path and do all he is doing..chase patrol attack as in (dont laugh) 2d game just like player on 2.5path..i mean i did some workaround for special parts where is needed but it would be easier and lazyier if enemy is constrained to path
|
|
|
Post by shadex on Oct 28, 2018 2:42:06 GMT
well...i want enemy to move as attached to path and do all he is doing..chase patrol attack as in (dont laugh) 2d game just like player on 2.5path..i mean i did some workaround for special parts where is needed but it would be easier and lazyier if enemy is constrained to path If you want them on a dedicated path, look into DoTween. Though you should also be able to do it with Invector AI by making a patrol path, and have a very small "chase" distance.
Now if you want to make it like a true old school 2d game, you can do it with like 2 states from the animator. Just make a walking state and an attack state and repeat them. Add a turn at the end and the enemy will just walk forward, attack, walk forward, attack, etc.
|
|
|
Post by ejlnmusic on Oct 28, 2018 7:34:36 GMT
What I did was when an enemy is close to the player, it moves on players X-axis so they get perfectly aligned when they are close to each other. It works and no performance issues. :D
|
|
|
Post by komposite on Nov 1, 2018 20:27:07 GMT
How did you achieve this ? I'm interested :D
|
|
|
Post by ejlnmusic on Nov 2, 2018 18:20:10 GMT
since i have turns and camera is rotating but it is always on the same distance to player i used that info to move enemy on that same distance...that way i could use turns and align enemy as needed for my specific needs
|
|
|
Post by komposite on Nov 13, 2018 9:45:59 GMT
Ok, I see. Could you share the code to do that ? It would help me a LOT ! Thanks
|
|
|
Post by komposite on Nov 22, 2018 0:10:17 GMT
I've found an other way, using the v_AIMotor script : Just go on line 227, 334, and 352, and for each _rigidbody.constraints, you sould write this :
_rigidbody.constraints = RigidbodyConstraints.FreezePositionX | RigidbodyConstraints.FreezeRotation;
But don't change that on the line 332, otherwise your AI won't be able to go to the navmesh.
The result is ok, but maybe your solution is better. I don't know.
It's, at least, better than having a small navmesh and no constraint
|
|