SlideShare a Scribd company logo
Box2D AS3 Quick Start Chris Black
What is Box2D for Flash? “Box2DFlashAS3 is an open source port of Erin Catto's powerful c++ physics library Box2D.”  –Box2DFlash Current version 2.0.1 Flash and 1.4.3.1 for JavaScript. Box2D can be used to quickly add ‘real life’ physics to your Flash / Flex projects.
Uses of Box2D Games, physics demos and… games. Very little practical application outside of games. Clients looking for animation often feel Box2D looks too ‘real.’
AS3 Physics Comparison For a great comparison on physics engines available for Flash check out this post: http://www.emanueleferonato.com/2008/04/24/flash-physics-engines-galore/
Box2D vs Flash CS5 Flash CS5 has a built in engine for creating STATIC demos.  Box2D should be used when user interaction is required for DYNAMIC apps. If your animation changes based on user interaction, use Box2D.
Getting Started Grab the quick start demo from Google Code Starting from scratch: Add the SWC or download Box2D source Set up your constants Create a world with boundries Add objects to the world
Constants public static const PHYS_SCALE:Number = 10; // Number of pixels in a Meter. public static const TIMESTEP:Number = 1.0 / 15.0; // How many physical calculations per timestep. Usually  1 / 15 or 1 / 60. public static const ITERATIONS:Number = 10.0; // The suggested iteration count is 10.
Create a World
2D Object VO
Create an Object
Add Object to the World
Demo Basketball Demo Car Demo
Box2D for Android GPU Acceleration CacheAsBitmapMatrix 30 fps on the Nexus One Video demo on Nexus One
Box2D for iOS Box2D doesn’t perform well using the iOS exporter within Flash CS5. This might improve with future iterations but for now use native Objective-C for iOS apps that require physics.
Box2D for JavaScript Older version compared to Flash Doesn’t perform as well on a PC Takes longer to code Worth trying out but needs some major updates before it will compare to Flash.
Now what? Download http://box2dflash.sourceforge.net/ http://box2d-js.sourceforge.net/ Learn http://www.emanueleferonato.com/category/box2d/ http://www.blackcj.com/blog/tag/box2d/

More Related Content

Viewers also liked

Transforming c urriculum nov 25b
Transforming c urriculum nov 25bTransforming c urriculum nov 25b
Transforming c urriculum nov 25bGordon Powell
 
Transforming curriculum mar 10
Transforming curriculum mar 10Transforming curriculum mar 10
Transforming curriculum mar 10Gordon Powell
 
McRoberts sep 2015pdf2
McRoberts sep 2015pdf2McRoberts sep 2015pdf2
McRoberts sep 2015pdf2Gordon Powell
 
Windows 8 Apps with HTML & JavaScript
Windows 8 Apps with HTML & JavaScriptWindows 8 Apps with HTML & JavaScript
Windows 8 Apps with HTML & JavaScriptChris Black
 
Monetizing Mobile Apps
Monetizing Mobile AppsMonetizing Mobile Apps
Monetizing Mobile AppsChris Black
 
Build a Flash Game in Under 3KB
Build a Flash Game in Under 3KBBuild a Flash Game in Under 3KB
Build a Flash Game in Under 3KBChris Black
 

Viewers also liked (7)

Transforming c urriculum nov 25b
Transforming c urriculum nov 25bTransforming c urriculum nov 25b
Transforming c urriculum nov 25b
 
Transforming curriculum mar 10
Transforming curriculum mar 10Transforming curriculum mar 10
Transforming curriculum mar 10
 
McRoberts sep 2015pdf2
McRoberts sep 2015pdf2McRoberts sep 2015pdf2
McRoberts sep 2015pdf2
 
Flex Appeal
Flex AppealFlex Appeal
Flex Appeal
 
Windows 8 Apps with HTML & JavaScript
Windows 8 Apps with HTML & JavaScriptWindows 8 Apps with HTML & JavaScript
Windows 8 Apps with HTML & JavaScript
 
Monetizing Mobile Apps
Monetizing Mobile AppsMonetizing Mobile Apps
Monetizing Mobile Apps
 
Build a Flash Game in Under 3KB
Build a Flash Game in Under 3KBBuild a Flash Game in Under 3KB
Build a Flash Game in Under 3KB
 

Recently uploaded

In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsExpeed Software
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKUXDXConf
 
Intelligent Gimbal FINAL PAPER Engineering.pdf
Intelligent Gimbal FINAL PAPER Engineering.pdfIntelligent Gimbal FINAL PAPER Engineering.pdf
Intelligent Gimbal FINAL PAPER Engineering.pdfAnthony Lucente
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessUXDXConf
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor TurskyiFwdays
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...CzechDreamin
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCzechDreamin
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka DoktorováCzechDreamin
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty SecureFemke de Vroome
 
Agentic RAG What it is its types applications and implementation.pdf
Agentic RAG What it is its types applications and implementation.pdfAgentic RAG What it is its types applications and implementation.pdf
Agentic RAG What it is its types applications and implementation.pdfChristopherTHyatt
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityScyllaDB
 
Enterprise Security Monitoring, And Log Management.
Enterprise Security Monitoring, And Log Management.Enterprise Security Monitoring, And Log Management.
Enterprise Security Monitoring, And Log Management.Boni Yeamin
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxJennifer Lim
 
Motion for AI: Creating Empathy in Technology
Motion for AI: Creating Empathy in TechnologyMotion for AI: Creating Empathy in Technology
Motion for AI: Creating Empathy in TechnologyUXDXConf
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoTAnalytics
 
The architecture of Generative AI for enterprises.pdf
The architecture of Generative AI for enterprises.pdfThe architecture of Generative AI for enterprises.pdf
The architecture of Generative AI for enterprises.pdfalexjohnson7307
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsPaul Groth
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyJohn Staveley
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxAbida Shariff
 

Recently uploaded (20)

In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT Professionals
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAK
 
Intelligent Gimbal FINAL PAPER Engineering.pdf
Intelligent Gimbal FINAL PAPER Engineering.pdfIntelligent Gimbal FINAL PAPER Engineering.pdf
Intelligent Gimbal FINAL PAPER Engineering.pdf
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
 
Agentic RAG What it is its types applications and implementation.pdf
Agentic RAG What it is its types applications and implementation.pdfAgentic RAG What it is its types applications and implementation.pdf
Agentic RAG What it is its types applications and implementation.pdf
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
Enterprise Security Monitoring, And Log Management.
Enterprise Security Monitoring, And Log Management.Enterprise Security Monitoring, And Log Management.
Enterprise Security Monitoring, And Log Management.
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
 
Motion for AI: Creating Empathy in Technology
Motion for AI: Creating Empathy in TechnologyMotion for AI: Creating Empathy in Technology
Motion for AI: Creating Empathy in Technology
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
The architecture of Generative AI for enterprises.pdf
The architecture of Generative AI for enterprises.pdfThe architecture of Generative AI for enterprises.pdf
The architecture of Generative AI for enterprises.pdf
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 

ActionScript Box2D Quick Start

  • 1. Box2D AS3 Quick Start Chris Black
  • 2. What is Box2D for Flash? “Box2DFlashAS3 is an open source port of Erin Catto's powerful c++ physics library Box2D.” –Box2DFlash Current version 2.0.1 Flash and 1.4.3.1 for JavaScript. Box2D can be used to quickly add ‘real life’ physics to your Flash / Flex projects.
  • 3. Uses of Box2D Games, physics demos and… games. Very little practical application outside of games. Clients looking for animation often feel Box2D looks too ‘real.’
  • 4. AS3 Physics Comparison For a great comparison on physics engines available for Flash check out this post: http://www.emanueleferonato.com/2008/04/24/flash-physics-engines-galore/
  • 5. Box2D vs Flash CS5 Flash CS5 has a built in engine for creating STATIC demos. Box2D should be used when user interaction is required for DYNAMIC apps. If your animation changes based on user interaction, use Box2D.
  • 6. Getting Started Grab the quick start demo from Google Code Starting from scratch: Add the SWC or download Box2D source Set up your constants Create a world with boundries Add objects to the world
  • 7. Constants public static const PHYS_SCALE:Number = 10; // Number of pixels in a Meter. public static const TIMESTEP:Number = 1.0 / 15.0; // How many physical calculations per timestep. Usually 1 / 15 or 1 / 60. public static const ITERATIONS:Number = 10.0; // The suggested iteration count is 10.
  • 11. Add Object to the World
  • 13. Box2D for Android GPU Acceleration CacheAsBitmapMatrix 30 fps on the Nexus One Video demo on Nexus One
  • 14. Box2D for iOS Box2D doesn’t perform well using the iOS exporter within Flash CS5. This might improve with future iterations but for now use native Objective-C for iOS apps that require physics.
  • 15. Box2D for JavaScript Older version compared to Flash Doesn’t perform as well on a PC Takes longer to code Worth trying out but needs some major updates before it will compare to Flash.
  • 16. Now what? Download http://box2dflash.sourceforge.net/ http://box2d-js.sourceforge.net/ Learn http://www.emanueleferonato.com/category/box2d/ http://www.blackcj.com/blog/tag/box2d/