Rotation from Vectors

From Schmid.wiki
Jump to: navigation, search

Notes


	Vector3 rotationAxis = Vector3.Cross(newDirection, Vector3.up);
	float rotationAngle = Mathf.Acos(
		Vector3.Dot(newDirection.normalized, Vector3.up));

	// a dot b = |a| |b| cos angle
	//
        //                a dot b
	// angle = acos ( ------- )
	//                |a| |b| 
	//
	// assuming that |a| = |b| = 1, we have:
	//
	// angle = acos ( a dot b )

Personal tools