I am working on making a bird fly similar to this video http://www.youtube.com/watch?v=rK6BAqctcRk&feature=youtu.be&t=1m24s
This is going to be used in a VR project, I am going to use 3 trackers, one for my head and the other 2 on my hands. I have all the code worked out for getting the positions and orientations from the trackers. So now I am working on the bird flight.
I have been playing for a while, found a few flight scripts and experimented, but I am just getting confused. I am not that experienced with physics in Unity. I was hoping someone might be able to explain what I need to look at in simple terms.
So far I have the bird with a rigidbody, I have the mass as 0.01. To begin with I am applying a force to move it forward. I think I got this from an aeroplane script.
Vector3 AddPos = Vector3.forward;
AddPos = rigidbody.rotation * AddPos;
rigidbody.AddForce(AddPos * (Time.deltaTime));
I am just flapping the wings using key presses at the moment, but I am adding a vertical pulse with each wing flap using this.
Vector3 lift = transform.up * (Time.deltaTime * force);
bird.rigidbody.AddForce(lift, ForceMode.Impulse);
Eventually I will vary the force of the pulse based on the speed and distance of the wing flap.
But I need to work out things like giving more lift based on speed when gliding. And being able to swoop down and up without crashing into the ground.
And I need to make the bird turn when I tilt it left or right. My attempts at turning it send it spinning wildly.
If anyone can give me some tips with this I would really appreciate it.