Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

unity werfen mit höhe

Vector3 CalculateLaunchVelocity(Vector3 from, Vector3 to, float height) 
{
	float displacementY = to.y - from.y;
	Vector3 displacementXZ = new Vector3(to.x - from.x, 0, to.z - from.z);
	
	Vector3 velocityY = Vector3.up * Mathf.Sqrt(-2 * gravity * height);
	Vector3 velocityXZ = displacementXZ / (Mathf.Sqrt(-2 * height / gravity) + Mathf.Sqrt(2 * (displacementY - height) / gravity));
	
	return velocityXZ + velocityY;
}
Source by # #
 
PREVIOUS NEXT
Tagged: #unity #werfen #mit
ADD COMMENT
Topic
Name
1+6 =