PlayStation®Mobile Development Cookbook by Fleischauer Michael
Author:Fleischauer, Michael [Fleischauer, Michael]
Language: eng
Format: epub
Publisher: Packt Publishing
Published: 0101-01-01T00:00:00+00:00
There's more...
Up until this recipe, we have paid no attention to the actual units we were using; we simply treated one unit in the physics simulation to equal one pixel in the game. There is nothing wrong with this, but it can lead to some remarkably odd values. In this recipe, we convert from pixels to physics units and vice versa. Physics2D is set up so that 1 unit of measurement = 1 meter, while 1 unit of weight = 1 kg and 1 unit of force = 1 Newton. When you start using real world units, the simulation becomes much easier to understand. In this case we are going to translate at a rate of 50 to 1, in that 50 pixels = 1 meter. This value was chosen arbitrarily; feel free to change it.
You may at this point be wondering about the values you pass in to simulate. The first is the index of the item the user clicked (within the SceneBodies array), while clickPosition and diffPosition allow you to specify two points used to apply velocity to the rigid body specified by the clickIndex variable. So basically it allows you to apply motion to the item touched and, frankly, I think it was bad design.
Earlier we mentioned that force was applied as Newtons. Therefore, when we subtract 40 force, we are actually subtracting 40 Newtons. One Newton is equivalent to the force of earth's gravity acting on an object weighing about 100 gms, which is approximately the weight of an apple. Had Newton been hit on the head with say, an anvil, a Newton would be a much different unit of measure!
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Deep Learning with Python by François Chollet(12520)
Hello! Python by Anthony Briggs(9867)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9757)
The Mikado Method by Ola Ellnestam Daniel Brolund(9747)
Dependency Injection in .NET by Mark Seemann(9293)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8258)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7741)
Grails in Action by Glen Smith Peter Ledbrook(7667)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7517)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(6743)
Microservices with Go by Alexander Shuiskov(6510)
Practical Design Patterns for Java Developers by Miroslav Wengner(6408)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6386)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6378)
Angular Projects - Third Edition by Aristeidis Bampakos(5765)
The Art of Crafting User Stories by The Art of Crafting User Stories(5296)
NetSuite for Consultants - Second Edition by Peter Ries(5241)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5058)
Kotlin in Action by Dmitry Jemerov(5019)
