思路物理学的滚动骰子

编程入门 行业动态 更新时间:2024-10-23 16:18:29
本文介绍了思路物理学的滚动骰子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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.

更多推荐

思路物理学的滚动骰子

本文发布于:2023-06-04 19:09:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/503352.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:骰子   物理学   思路

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!