Search Unity

Aircraft Pathing and Movement

Discussion in 'Scripting' started by Lysv, Jul 31, 2015.

  1. Lysv

    Lysv

    Joined:
    Jul 26, 2015
    Posts:
    2
    I've been working on a game where one of the features is assuming direct control over certain crafts. Currently I am working on a zeppelin, but I've found myself unable to do make it work properly when the user is not in direct control.

    Quick summary of the zeppelin's workings. Rigidbody not affected by gravity ( since it's as light as air ). Uses the AddForce and AddTorque for it's controls and can move forward and backwards, up and down, and turn about the y-axis. Each direction has it's own possible force ( turning right might be faster than turning left ). Mixed with drag and mass it does make for a rather fun thing to control - but I can't for the life of me make it work with even the most rudamentary AI or prediction.

    I've tried to make it turn towards a point and move forward when turned towards the right direction ( within a few degrees ), and it works great when at a really far distance. Once I get close it is unusable as it either constantly stops, realigns, moves a little bit, and then repeats it all in a rather ugly fashion or it just constantly overshoots and has to turn back. Not to mention that it kinda bounces up and down.
    If anyone knows a good way to do this part I'd be quite thankful.

    On the same-ish topic I'd also like for some help regarding planning paths. I don't really care about avoid obstacles for now, but what I do need is to be able to come to the target point from a certain angle ( for example, to the starting-point of an attack-run ). I tried an Euler curve, but it doesn't work when the angles are too aligned. Again, if anyone knows a better way - preferably one that actually works out the actual path the zeppelin can take.