思路物理学的滚动骰子 [英] Ideas for physics for rolling dice

查看:105
本文介绍了思路物理学的滚动骰子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

这篇关于思路物理学的滚动骰子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆