TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

2D Rigid Body Collision Resolution

476 点作者 atan212 个月前

25 条评论

ksassnowski12 个月前
Hey everyone, author here!<p>To give some context, this is only part one in a series of blog posts I plan on writing about rigid body physics.<p>The post is aimed at people like myself, who aren&#x27;t game devs and don&#x27;t necessarily have a strong math background. Which is why I spend so much time explaining concepts that would appear almost trivial to someone who has experience in this area.<p>Happy to answer any questions you might have.
评论 #40466724 未加载
评论 #40464113 未加载
评论 #40465651 未加载
评论 #40465130 未加载
评论 #40463977 未加载
评论 #40468731 未加载
评论 #40464596 未加载
评论 #40466785 未加载
评论 #40464216 未加载
评论 #40470456 未加载
redbell12 个月前
Oh! Look, a well-researched, deeply-explained, and <i>interactive</i> post.<p>Honestly, when I initially read the domain name and noticed the TLD is &quot;<i>.ski</i>&quot; I was thinking it is from the author who wrote about <i>Mecanical Watch</i> [1] and other cool stuff.. it turned out to be a totally different one but of similar quality. What&#x27;s the secret sauce behind this &quot;<i>.ski</i>&quot; TLD :)<p>___________________<p>1. <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=31261533">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=31261533</a>
评论 #40469928 未加载
onetimeuse9230412 个月前
One side project I am working on right now is a 2d space shooter I am developing with my son. The idea is to have top down look, have each player control some kind of ship and fly in an enclosed area filled with space debris and shot opponents. An important aspect of this game is that the space debris can be moved around the arena and used creatively to capture opponents, prevent them from achieving their goals, etc.<p>As part of the project I was thinking we will skip game engine altogether because I wanted to teach my son a bit more about how to structure the application, etc. I thought in future we would use a ready game engine but at least once we would go through the exercise of implementing everything.<p>Everything was fine until we approached the problem of collision detection and handling. That&#x27;s when things went downhill pretty quickly. Even with my theoretical math background I was soon consumed with just enormous amount of corner cases and finally decided to relent and use Box2d for this.<p>I am not a professional game developer, but I have over 20 years of development experience + math background and I still made the mistake of underestimating the problem. It really seems easy problem when you state it and just becomes exponentially more and more complex as you start digging into details.
评论 #40466792 未加载
评论 #40465830 未加载
评论 #40465387 未加载
评论 #40470703 未加载
samlinnfer12 个月前
I always enjoyed the explanation from the N game: <a href="https:&#x2F;&#x2F;www.metanetsoftware.com&#x2F;technique&#x2F;tutorialA.html" rel="nofollow">https:&#x2F;&#x2F;www.metanetsoftware.com&#x2F;technique&#x2F;tutorialA.html</a><p>Back when flash was everywhere.
mike31fr12 个月前
I had fun building a TypeScript demo about this topic, involving balls that can bounce and collide. I learned a lot.<p>Code: <a href="https:&#x2F;&#x2F;github.com&#x2F;vandrieu&#x2F;canvas-bouncing-ball">https:&#x2F;&#x2F;github.com&#x2F;vandrieu&#x2F;canvas-bouncing-ball</a> (the collision logic is in src&#x2F;collision.ts)<p>Result&#x2F;Demo: <a href="https:&#x2F;&#x2F;vandrieu.github.io&#x2F;canvas-bouncing-ball&#x2F;" rel="nofollow">https:&#x2F;&#x2F;vandrieu.github.io&#x2F;canvas-bouncing-ball&#x2F;</a>
评论 #40474628 未加载
ecaradec12 个月前
If you want to go further and go for rigid body dynamics and constraint, I found that series of blog post very useful: <a href="https:&#x2F;&#x2F;www.toptal.com&#x2F;game&#x2F;video-game-physics-part-i-an-introduction-to-rigid-body-dynamics" rel="nofollow">https:&#x2F;&#x2F;www.toptal.com&#x2F;game&#x2F;video-game-physics-part-i-an-int...</a>
评论 #40465124 未加载
33a12 个月前
Collisions are violations of the pairwise non-intersection constraint between bodies. Collision forces are Lagrange multipliers of these constraints. Collision normals are the (normalized) partial derivatives of the constraint function wrt one of the body&#x27;s configurations.
评论 #40464757 未加载
评论 #40465058 未加载
gustavopezzi12 个月前
This is really cool! Love the explanations, the interactions, and especially the friendly tone of voice of the article. Looking forward to the ones following.
aDyslecticCrow12 个月前
Making a 2d rigid-body physics engine is a really fun project. I made one myself in javascript before learning about linear algebra. And I dug deep into the maths to get it working. Despite months of work, I barely scratched the surface beyond the widely known basics.<p>Making a stable engine where objects don&#x27;t compress into one another or jitter is a rabbit hole without a bottom that even the most math-heavy articles I could find rarely touched.<p>I used a series of old articles by Christ Hecker to understand the maths myself. <a href="http:&#x2F;&#x2F;www.chrishecker.com&#x2F;Rigid_Body_Dynamics" rel="nofollow">http:&#x2F;&#x2F;www.chrishecker.com&#x2F;Rigid_Body_Dynamics</a>
评论 #40465636 未加载
mydriasis12 个月前
To learn JS I started with canvas, and without any game dev experience, made a couple of cute little browser games. One is a galaga clone that, for the most part, works OK. The hard part is the projectile collisions. Instead of taking the position of your bullet now, and where it would be in the next time step, and seeing if it would intersect with the enemy hitboxes taken in the same way, I _only_ checked on the current timestep, which means your bullets can magically go around the enemies! Silly stuff. Maybe some day I&#x27;ll go back and fix it.
nj5rq12 个月前
Wow, perfect timing. Some days ago I started to get interested in this, particularly in circle collisions. Keep it up, looking forward for the rest of the posts.
CooCooCaCha12 个月前
You probably don’t want rigid body collisions in most game mechanics. Player controllers, npc logic, etc. are hand crafted most of the time.
评论 #40465899 未加载
pkaler12 个月前
This is great. This reminds me of Chris Hecker&#x27;s Rigid Body Dynamics series from GDMag&#x2F;Gamasutra that I read (checks watch) almost 30 years ago! This is the classic&#x2F;canonical set of articles.<p><a href="https:&#x2F;&#x2F;chrishecker.com&#x2F;Rigid_Body_Dynamics" rel="nofollow">https:&#x2F;&#x2F;chrishecker.com&#x2F;Rigid_Body_Dynamics</a>
swayvil12 个月前
If you constrain your geometry to a tesselation, it gets much more precise, simple and fast.<p>Like those old atari games where everything was little square tiles &#x2F; pixels.<p>But little squares aren&#x27;t the most expressive geometry.<p>How about kisrhombille?<p><a href="https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;Kisrhombille" rel="nofollow">https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;Kisrhombille</a>
isoprophlex12 个月前
Huh. I always remembered it as being <i>s</i> because of French <i>sentier</i>, meaning &quot;path&quot;.<p>Besides that... Beautiful page, well done!
danbmil9912 个月前
Guess this is a Shameless plug but I wrote an interesting program over 12 years ago using even then very old three Js which is not quite the metal but much less abstract than today&#x27;s tools. I&#x27;m always amazed when I check it and it&#x27;s still running<p><a href="http:&#x2F;&#x2F;busyboxes.org" rel="nofollow">http:&#x2F;&#x2F;busyboxes.org</a>
Terr_12 个月前
To dredge up a related oldie-but-goodie memory of blog posts:<p><a href="https:&#x2F;&#x2F;gafferongames.com&#x2F;categories&#x2F;game-physics&#x2F;" rel="nofollow">https:&#x2F;&#x2F;gafferongames.com&#x2F;categories&#x2F;game-physics&#x2F;</a>
rrr_oh_man12 个月前
I wish we had had this type of explanation in algebra on what to do with dot products.
willvarfar12 个月前
My own attempts at 3d games failed to get good sweeping polygon polygon collision to work. IIRC I found one good demo video of a programmer demonstrating it on youtube but no code or articles or anything.
TheRealPomax12 个月前
I do wish this kept going and went &quot;and as a last step, we need to add in torque&quot; because pretty much everyone stops at regular force vectors, but torque transfer is so ridiculously important.
NKosmatos12 个月前
Young high school and university students aspiring to become game designers should give some focus on their algebra, trigonometry and geometry :-)
roopekangas12 个月前
Thanks! This will be something I check with my kid in highschool!
filleduchaos12 个月前
I know this post is focused on collision resolution, but I was still a little disappointed to see collision detection handwaved away. In my experience that&#x27;s where the real headscratchers are.
评论 #40467282 未加载
评论 #40466123 未加载
liuxiaopai12 个月前
awesome article glad to read
smusamashah12 个月前
The way this article is written with small simulations throughout the page and word highlights was reminding me of <a href="https:&#x2F;&#x2F;ciechanow.ski&#x2F;" rel="nofollow">https:&#x2F;&#x2F;ciechanow.ski&#x2F;</a> and then I noticed the domain name. It is very similar too <a href="https:&#x2F;&#x2F;www.sassnow.ski&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.sassnow.ski&#x2F;</a><p>Couldn&#x27;t be happier seeing more people going to same depths (or heights) to explain things to people. Will be looking forward to more articles like this as this just the very first one.
评论 #40464638 未加载
评论 #40464468 未加载
评论 #40465399 未加载
评论 #40465617 未加载