思路物理学的滚动骰子骰子、物理学、思路

2023-09-11 22:51:11 作者:﹌ 倒霉蛋

我想使滚动立方体像骰子反应加速度计。因此,加速计给出了棱镜移动的参数。我认为,小的物理应该在这里使用。我的问题是什么配方,技术,我应该用它来实现这一点没有任何物理引擎。

I want to make rolling cube like dice that reacts on accelerometer. So accelerometer gives parameters for cube moving. I think that small physic should be used here. My question is what formulas, techniques should I use to accomplish this without any physics engine.

推荐答案

您可能需要使用OpenGL了点。有一个良好的物理教程 OGL这里

You will need probably to use OpenGL for that. There a good physics tutorial for OGL here

具体的骰子,看看这个诺基亚演示。这是写在CPP(这里 源)

Specifically for dice, take a look at this nokia demo. It's written in cpp (source here)

在物理学方面,你可以看看本网站。

On the physics side, you can take a look at this site.

无论如何,我不认为你需要的真正的物理学的应用程序,但只是一个近似值:

Anyhow, I do not think you need real physics for the app, but just an approximation:

我会开始得到的速度取决于加速度计(加或减,比方说,20%)和随机的角速度了解的霸气。 然后,找到 的轨迹为每接触边框时。 弹跳他们以一个或另一个方向取决于在特定时刻的旋转。 更改角速度的符号,如果骰子反弹。 减少约50%,每一个反弹的速度,直到阈值。 在门限以下,留在他们的地板和停止运动。 I would start getting a velocity that depends on the accelerometer (plus or minus, let's say, 20%) and random angular speeds for the dice. Then, find the trajectory for each and when touching a border. Bounce them to one direction or another depending on the rotation at that particular moment. Change the sign of the angular speed if the dice bounce back. Reduce the speed about 50% each bounce, until a threshold. Below that threshold, leave them in the floor and stop movement.