本文介绍了在游戏开发中找到物理教程的最佳位置是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对游戏开发非常陌生(特别是对于iPhone/iPad,如果真的很重要的话),并且在处理动画的物理部分时遇到了困难.具体来说,我正在尝试提供几个球(圆形UIImageView或CG圆)的物理属性(重力,重量,摩擦力等).

I'm very new to game development (iPhone/iPad specifically, if that matters at all) and am having a tough time with working with the physics part of animation. Specifically I'm trying to give several balls (circular UIImageView or CG circles) physical properties (gravity, weight, friction, etc).

关于游戏开发中的物理入门,是否有非常好的教程?教程的语言并不重要,因为物理运动的机制并没有真正改变.

Are there any really good tutorials on getting started with physics in game development? The language of the tutorial really doesn't matter as the mechanics of the physical movement really don't change.

推荐答案

由于您是游戏开发人员的新手,所以如果您的游戏相对复杂,我不建议您编写自己的物理代码.我有两个理由这样说:

Since you are new to game dev, I would not recommend writing your own physics code if your game is relatively complex. I have two reasons for saying this:

  1. 您需要知道如何将物理与游戏逻辑分开,以确保物理稳定性,同时最大程度地提高游戏逻辑的灵活性.
  2. 设计具有碰撞检测功能的物理引擎时有很多陷阱,其中许多已在现有物理引擎中解决.

如果您仍然想编写自己的物理学,我建议先创建一个具有良好现有物理学引擎的沙箱应用程序.查看物理引擎的哪些部分已公开,以及您希望公开哪些部分.接下来,深入研究物理代码,以了解如何根据速度,模拟重力,质量,摩擦力等来更新对象.了解如何检测到碰撞,以及在极端情况下引擎如何处理诸如隧道效应和碰撞响应之类的问题.

If you are still set on writing your own physics, I recommend starting by creating a sandbox application with a good existing physics engine. Look at what parts of the physics engine are exposed, and what parts you would like to have exposed. Next, dig into the physics code to see how the objects are updated according to velocity, simulation gravity, mass, friction, etc. See how collision is detected, and how the engine deals with things like tunneling and collision response for extreme cases.

Box2D是编写良好的开源物理引擎,并包含在Cocos2D中.您可以创建Box2D游戏模板并直接跳入该模板.

Box2D is well-written open-source physics engine, and is included in Cocos2D. You can create a Box2D game template and jump right into it.

这篇关于在游戏开发中找到物理教程的最佳位置是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 16:46