Skip to Content
Swift游戏开发经典实例
book

Swift游戏开发经典实例

by Jonathon Manning, Paris Buttfield-Addison
January 2020
Intermediate to advanced
356 pages
6h 4m
Chinese
China Electric Power Press Ltd.
Content preview from Swift游戏开发经典实例
217
7
物理学
在一个受重力支配的行星上,物体受外力作用及物体间发生碰撞是一件再普通不过
的事情。当你拿起一个物体然后松手,它会垂直下落,一直到它碰到什么地方。当
它碰到其他物体时,它还会反弹(或者碎裂,这要看你扔下的是什么东西)。在游
戏中,我们通过物理引擎模拟物体的这种行为。
物理引擎允许我们:
使物体受重力影响并向地上坠落。
给物体赋予重力、密度、摩擦力、弹性等属性。
给物体施以作用力,让它们真实地移动。
根据各种参数将物体聚合在一起。
简而言之,将物理引擎添加到游戏中后能获得更真实的效果。
Sprite Kit
内置了
2D
物理引擎,本章的全部内容都和
Sprite Kit
物理引擎相关(如
果你还不熟悉
Sprite Kit
,请先学习第
6
章)。在开始介绍本章“技巧”之前,先
让我们来认识一下相关术语。
7.1
物理学术语和定义
数学是物理引擎的基础,数学家们有给东西命名的癖好。这些术语在
iOS
内置的物
理引擎中频繁出现,因此我们有必要了解它们的含义,如什么是“多边形碰撞体”。
218
7
在我们开始介绍本章的主题之前,我们会在这里介绍一些术语的定义,这样,当我
们正式使用物理引擎时,这些定义才不会成为我们的绊脚石。在这些术语中,有的
你可能在其他地方听说过,但有的则是物理引擎中特有的: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

精通機器學習

精通機器學習

Aurélien Géron
FreeBSD® Unleashed

FreeBSD® Unleashed

Brian Tiemann, Michael C. Urban
深入淺出代數

深入淺出代數

Tracey Pilone, Dan Pilone
Swift学习手册

Swift学习手册

Jon Manning, Paris Buttfield-Addison, Tim Nugent

Publisher Resources

ISBN: 9787519840129