Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Procedural Content Generation for Unity Game Development

You're reading from   Procedural Content Generation for Unity Game Development Harness the power of procedural content generation to design unique games with Unity

Arrow left icon
Product type Paperback
Published in Jan 2016
Publisher
ISBN-13 9781785287473
Length 260 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Ryan Watkins Ryan Watkins
Author Profile Icon Ryan Watkins
Ryan Watkins
Arrow right icon
View More author details
Toc

Exploring the planet


Now that we have generated a planet, it would be awesome if we could explore the surface of it. As a fun bonus, we will add a first-person-view controller, so we can explore our planets. Fortunately for us, someone has already tackled the problem of spherical gravity in Unity, so all we will have to do is plug and play.

You can get the script for this section either from the example files or from its source at https://github.com/SebLague/Spherical-Gravity by SebLague. There is also a video at that location where you can see how the scripts work. The scripts that are included are the FirstPersonController.cs, GravityAttractor.cs, and GravityBody.cs.

You are welcome to view the video to get an explanation on the code in these scripts. We are just going to plug them in and use them as they are, though. You'll want to add the GravityAttractor script to the Water object. Set a tag for the Water sphere to Planet. Then, create a capsule for our first person controller by navigating...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime