android – 我可以在哪里学习如何实现’我的水在哪里’的物理学?
作者:互联网
我正在开发一种游戏,其中水作为一种属性,可用于解决谜题并与其他屏幕元素进行交互,我非常有兴趣了解他们如何设法获得如此流畅的物理交互.
使用粒子可以用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