我一直在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