SlideShare une entreprise Scribd logo
1  sur  16
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/

Contenu connexe

En vedette

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
 

En vedette (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
 

Dernier

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 

Dernier (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.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/