Simulation a Frisbee throw - How to give the curve effect ?

Hello everyone,

I have begun Unity3D a few days ago, and the main idea for my first game was a “Frisbee throw game”.

I don’t know how to throw the frisbee and let it make a curve in the air.
If someone has an idea how to do it, it would be nice :slight_smile: !

Here is the script I wrote for throwing the frisbee. It throws the frisbee when I put the left click (using addForce and putting isKinetic to false), and make it spin too (launching Rotate() in Update() until it touches something (the ground here) :

    using UnityEngine;
    using System.Collections;
    
    public class launchFrisbee : MonoBehaviour {
    
    	const int LEFTCLICK = 0;
    	const int RIGHTCLICK = 1;
    
    	public Vector3 _force;
    	private bool bIsThrown = false;
    	private bool bRotate = false;
    	private bool bTouchedTheGround = false;
    
    	public void OnDrawGizmos()
    	{
    		Debug.DrawLine(transform.position, transform.position + _force / Physics.gravity.magnitude, Color.red);
    	}
    
    	void Start () {
    	}
    	
    	// Update is called once per frame
    	void Update () {
    		if (Input.GetMouseButtonDown (LEFTCLICK) && !bIsThrown) {
    			this.rigidbody.isKinematic = false;
    			this.rigidbody.AddForce (_force);
    			bIsThrown = true;
    			bRotate = true;
    
    		}
    
    		if (bRotate && !bTouchedTheGround) {
    			Rotate();
    		}
    	}
    
    	void Rotate() {
    		this.rigidbody.transform.Rotate (Vector3.up, 2000f * Time.deltaTime);
    	}
    
    	void OnCollisionEnter(Collision collision) {
    		bTouchedTheGround = true;
    	}
    
    }

Thanks :slight_smile: !

Assuming you built your Frizbee so that the top of it points up when the rotation is (0,0,0), you can do something like this:

void FixedUpdate () {
    if (!bTouchedTheGround) {  // Curve force added each frame
       Vector3 sideDir = Vector3.Cross(transform.up, rigidbody.velocity).normalized;
       AddForce(sideDir * curveAmount);
}

‘curveAmount’ is a variable you or your user set with 0.0 resulting in a straight throw. It needs to be a small number, since it gets applied each frame. The higher the number, the more the curve. The sign of the value determines whether it curves left or right.

Note that after you get this up and running, you may need to introduce banking to make the Frisbee throw look right.