void _updateDirAndTimeByEdge(FP _percent, TSVector2 hitNormal, BallObj ball, FP _deltaTime) { ball.UpdateBallPos(_deltaTime * _percent); //先更新到撞击点 var curReflcDir = Detection.CheckCircle_EdgeCollision(hitNormal, ball.GetMoveDir()); //计算碰撞响应 ball.UpdateMoveDir(curReflcDir); //更新实时方向 }
void updateDirAndTimeByBall(FP _percent, BallObj runball, BallObj staticball, FP _deltaTime) { runball.UpdateBallPos(_deltaTime * _percent);//先更新到撞击点 staticball.UpdateBallPos(_deltaTime * _percent); //var runcrd = new CircleRunData(runball.GetPos(), runball.PredictPos(_deltaTime), runball.GetRadius()); //var staticcrd = new CircleRunData(staticball.GetPos(), staticball.PredictPos(_deltaTime), staticball.GetRadius()); var curReflcDir = Detection.CheckCircle_CircleCollision(runball.GetPos(), runball.GetMoveDir(), staticball.GetPos(), staticball.GetMoveDir());//计算碰撞响应 runball.UpdateMoveDir(curReflcDir[0]); staticball.UpdateMoveDir(curReflcDir[1]); }
void updateDirAndTimeByEdge(FP _percent, tableEdge _tbe, BallObj ball, FP _deltaTime) { ball.UpdateBallPos(_deltaTime * _percent); //先更新到撞击点 var curReflcDir = Detection.CheckCircle_LineCollision(_tbe, ball.GetPos(), ball.GetRadius(), ball.GetMoveDir()); //计算碰撞响应 ball.UpdateMoveDir(curReflcDir); //更新实时方向 }