标签:android iphone box2d physics
我正在开发一种游戏,其中水作为一种属性,可用于解决谜题并与其他屏幕元素进行交互,我非常有兴趣了解他们如何设法获得如此流畅的物理交互.
使用粒子可以用Box2D完成吗?
解决方法:
在看到你正在谈论的游戏视频后(在被告知你正在谈论特定游戏之后),我认为metaballs模拟可能会成功.
谷歌搜索“我的水元球在哪里”,我找到了如何在Ludum Dare条目中实现这个精确游戏的描述:
http://www.ludumdare.com/compo/?p=104952&preview=true
Particle simulator would be best but integrating that to game would take some precious time that I didn’t have. So I created a pool and obstacles and hefty amount of small slippery balls with pretty high density. You don’t want any friction, damping and only small amount of restitution. Radius of one ball is about 0.25m when my full screen size is 48m x 32m.
Simulating lots of dynamic bodies that clamp often to one place is really heavy weight operation. This need to be taken consideration. For this reason I used really inaccurate physic settings. I stepped world with only one velocity and position substeps. Also I fixed physic steps to 30/s.(After competition I noticed 20 would be enough) Always when dealing with fixed time step you want to interpolate or extrapolate position when physic are not stepped but rendering is. I choosed extrapolationing. This is simple to pull of.
RenderPos = PhysicalPos + Velocity * TimeAccumulator
然后他们继续描述渲染是如何欺骗玩家相信它是一个流动的而不是微小的球.他们使用一种形式的元球渲染.
My method was to render water drops as metaballs with radius twice the physical size of the object. Fastest way to make metaball was just sprite that is opaque at middle and fully transparent at edges with smooth circular gradient.
标签:android,iphone,box2d,physics 来源: https://codeday.me/bug/20190902/1789567.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。