我一直在C#中编写一个简单的程序,其中一个球 [X,Y]坐标是周期递增的。2D游戏物理矢量问题
我已经设法实现了一个碰撞检测方法,但我试图确定如何在一个角度反射球沿着相同的线性路径反弹回来。
dx = -dx //This bounces the ball back along the same linear path
dy = -dy
解决方案 三角
theta = range between 0<theta<=360 depending on where it bounced
x = cos(theta)*time
y= sin(theta)*time
不!基本物理学不是随机的。你需要量子物理学。或者只是将你的参数(反射角)乘以一些随机系数。 ;) – AndreKR 2010-11-12 22:57:34
虽然这是真的,但这并没有回答这个问题。 – 2010-11-12 23:09:19