package
{
      import   flare.basic.Scene3D;
      import   flare.basic.Viewer3D;
      import   flare.core.Light3D;
      import   flare.materials.FlatColorMaterial;
      import   flare.primitives.Cube;
      import   flare.primitives.Plane;
      import   flare.primitives.ShadowPlane;
      import   flare.primitives.Sphere;
      import   flare.system.Device3D;

     import    flash.display.Sprite;
     import    flash.events.Event;
     import    flash.geom.Vector3D;
     import    flash.utils.getTimer;

     import jiglib.physics.RigidBody;
     import jiglib.plugin.flare3d.Flare3DPhysics;




     public class Flare3dJiglib extends Sprite
     {

           private var physics:Flare3DPhysics;
           private var scene:Scene3D;
           private var r:RigidBody;
           private var light:Light3D;
           public function Flare3dJiglib()
           {

                   // create the scene.
                   scene = new Viewer3D( this )

                   physics = new Flare3DPhysics(scene,2);

                  physics.createGround("ground",new
FlatColorMaterial("pink",0xff00ff),100,0);


                   var cube:RigidBody = physics.createCube("cube",null);
                   cube.y = 150;

                   var sphere:RigidBody;
                   sphere = physics.createSphere("s",null);
                   sphere.y = 50;
                   sphere.x = 6;


                   //r.addBodyForce(new Vector3D(0,100,0),new Vector3D());


                   // create the light.
                   light = new Light3D( "", Light3D.POINT_LIGHT )

                   // set the light as default light.
                   Device3D.defaultLight = light
// create the shadow plane.
                  var plane:ShadowPlane = new ShadowPlane("", scene, light, 100,
100, 256, 256 )
                  plane.setPriority( 100 )
                  plane.alpha = 0.2;
                  scene.addChild( plane )
                  plane.setPosition(0,0,0);

                  scene.camera.setPosition( 0, 200,50 )
                  scene.camera.lookAt(0,0,0);


                  addEventListener(Event.ENTER_FRAME,update);
           }

           private function update(e:Event):void
           {
                 physics.step();
                 light.x = Math.sin( getTimer() / 1000 ) * 200
                 light.z = Math.cos( getTimer() / 1500 ) * 200
                 light.y = 250

           }
     }
}

More Related Content

DOCX
Stack array
PPT
Artdm170 Week10 Arrays Math
PDF
ECMAScript 6 major changes
PDF
The Ring programming language version 1.3 book - Part 49 of 88
PDF
Ray Tracing with ZIO
PDF
Part2 from math import * from simpson import * k=1 def f(x): return (exp(-(x...
DOCX
Simulate elliptical orbit in pygame
DOCX
Simulate bouncing ball in pygame
Stack array
Artdm170 Week10 Arrays Math
ECMAScript 6 major changes
The Ring programming language version 1.3 book - Part 49 of 88
Ray Tracing with ZIO
Part2 from math import * from simpson import * k=1 def f(x): return (exp(-(x...
Simulate elliptical orbit in pygame
Simulate bouncing ball in pygame

What's hot (20)

PDF
The Ring programming language version 1.7 book - Part 71 of 196
PDF
Ssaw08 0624
PDF
The Ring programming language version 1.9 book - Part 71 of 210
PDF
Ray tracing with ZIO-ZLayer
PDF
Mozilla とブラウザゲーム
PDF
Building Real Time Systems on MongoDB Using the Oplog at Stripe
PDF
Building Real Time Systems on MongoDB Using the Oplog at Stripe
PDF
What they don't tell you about JavaScript
PPTX
My favorite slides
PDF
[131]해커의 관점에서 바라보기
PDF
10CSL67 CG LAB PROGRAM 7
PDF
Simple Neural Network Python Code
PDF
The Ring programming language version 1.9 book - Part 56 of 210
PPTX
ES6(ES2015) is beautiful
PDF
Building Real Time Systems on MongoDB Using the Oplog at Stripe
PDF
C++ TUTORIAL 6
PPTX
Oprerator overloading
PDF
C++ TUTORIAL 7
PDF
ゼロから始めるScala文法
The Ring programming language version 1.7 book - Part 71 of 196
Ssaw08 0624
The Ring programming language version 1.9 book - Part 71 of 210
Ray tracing with ZIO-ZLayer
Mozilla とブラウザゲーム
Building Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at Stripe
What they don't tell you about JavaScript
My favorite slides
[131]해커의 관점에서 바라보기
10CSL67 CG LAB PROGRAM 7
Simple Neural Network Python Code
The Ring programming language version 1.9 book - Part 56 of 210
ES6(ES2015) is beautiful
Building Real Time Systems on MongoDB Using the Oplog at Stripe
C++ TUTORIAL 6
Oprerator overloading
C++ TUTORIAL 7
ゼロから始めるScala文法
Ad

Viewers also liked (20)

PPTX
Why Don't You Be Happy?
PDF
Inside the social media mind
PPTX
Nighty Lighty
PPT
Kock tavares
PPTX
Digital Marketing Trends 2013
DOC
PráCtica Del MóDulo De EduacióN A Distancia
PPTX
Embedded programming
PPT
Software
PPTX
Sponsor Generated Programming SPAA Fringe 2010
PDF
Ps end post for slideshare
PPTX
Schedule
PPTX
Ben Kunz Mediassociates speech to Boise Ad Federation
PPT
PDF
Informe Europeo de Wireless
PDF
10 Social Media Things to Try in 10 Minutes
PPTX
Digital babysitter
PDF
Integratedbook
PDF
iGapYear
PPTX
Molding And Casting
PDF
Rider S Manual K 1200 R 2008
Why Don't You Be Happy?
Inside the social media mind
Nighty Lighty
Kock tavares
Digital Marketing Trends 2013
PráCtica Del MóDulo De EduacióN A Distancia
Embedded programming
Software
Sponsor Generated Programming SPAA Fringe 2010
Ps end post for slideshare
Schedule
Ben Kunz Mediassociates speech to Boise Ad Federation
Informe Europeo de Wireless
10 Social Media Things to Try in 10 Minutes
Digital babysitter
Integratedbook
iGapYear
Molding And Casting
Rider S Manual K 1200 R 2008
Ad

Similar to Flare3d jiglib.as (20)

PPTX
Developing 2D Games with Stage3D
PDF
Neurotech Solutions Ltd: Рекомендации по Stage3D: выбор наиболее подходящего ...
KEY
openFrameworks 007 - 3D
PDF
Getting Started with 3D Game Development on Nokia Series 40 Asha Phones
PPTX
Introduction to open gl in android droidcon - slides
PDF
How to Clone Flappy Bird in Swift
DOCX
openGl example
PDF
Box2D and libGDX
PDF
WPF L03-3D Rendering and 3D Animation
PPT
Shadow Volumes on Programmable Graphics Hardware
PPT
Geometry Shader-based Bump Mapping Setup
PPT
Advanced Game Development with the Mobile 3D Graphics API
ZIP
Adobe AIR: Stage3D and AGAL
KEY
openFrameworks 007 - GL
PPT
Paris Master Class 2011 - 04 Shadow Maps
PDF
HTML5 game dev with three.js - HexGL
PDF
WebGL - 3D in your Browser
DOCX
Robot Motion Source code
ZIP
Disney Effects: Building web/mobile castle in OpenGL 2D & 3D
PDF
Modify code to change cube into pyramid.Javascriptuse strict.pdf
Developing 2D Games with Stage3D
Neurotech Solutions Ltd: Рекомендации по Stage3D: выбор наиболее подходящего ...
openFrameworks 007 - 3D
Getting Started with 3D Game Development on Nokia Series 40 Asha Phones
Introduction to open gl in android droidcon - slides
How to Clone Flappy Bird in Swift
openGl example
Box2D and libGDX
WPF L03-3D Rendering and 3D Animation
Shadow Volumes on Programmable Graphics Hardware
Geometry Shader-based Bump Mapping Setup
Advanced Game Development with the Mobile 3D Graphics API
Adobe AIR: Stage3D and AGAL
openFrameworks 007 - GL
Paris Master Class 2011 - 04 Shadow Maps
HTML5 game dev with three.js - HexGL
WebGL - 3D in your Browser
Robot Motion Source code
Disney Effects: Building web/mobile castle in OpenGL 2D & 3D
Modify code to change cube into pyramid.Javascriptuse strict.pdf

More from Fabricio Goncalves (8)

PDF
SRE - Engenharia de confiabilidade de sites 4
PDF
SRE - Engenharia de confiabilidade de sites 3
PDF
SRE - Engenharia de Confiabilidade de Sites 2
PDF
SRE - Engenharia de Confiabilidade de Sites
PDF
Monolith - An epic journey
PDF
Flash Power (pt 2)
PDF
Flash Power (pt 1)
PPT
Games withflare3d
SRE - Engenharia de confiabilidade de sites 4
SRE - Engenharia de confiabilidade de sites 3
SRE - Engenharia de Confiabilidade de Sites 2
SRE - Engenharia de Confiabilidade de Sites
Monolith - An epic journey
Flash Power (pt 2)
Flash Power (pt 1)
Games withflare3d

Flare3d jiglib.as

  • 1. package { import flare.basic.Scene3D; import flare.basic.Viewer3D; import flare.core.Light3D; import flare.materials.FlatColorMaterial; import flare.primitives.Cube; import flare.primitives.Plane; import flare.primitives.ShadowPlane; import flare.primitives.Sphere; import flare.system.Device3D; import flash.display.Sprite; import flash.events.Event; import flash.geom.Vector3D; import flash.utils.getTimer; import jiglib.physics.RigidBody; import jiglib.plugin.flare3d.Flare3DPhysics; public class Flare3dJiglib extends Sprite { private var physics:Flare3DPhysics; private var scene:Scene3D; private var r:RigidBody; private var light:Light3D; public function Flare3dJiglib() { // create the scene. scene = new Viewer3D( this ) physics = new Flare3DPhysics(scene,2); physics.createGround("ground",new FlatColorMaterial("pink",0xff00ff),100,0); var cube:RigidBody = physics.createCube("cube",null); cube.y = 150; var sphere:RigidBody; sphere = physics.createSphere("s",null); sphere.y = 50; sphere.x = 6; //r.addBodyForce(new Vector3D(0,100,0),new Vector3D()); // create the light. light = new Light3D( "", Light3D.POINT_LIGHT ) // set the light as default light. Device3D.defaultLight = light
  • 2. // create the shadow plane. var plane:ShadowPlane = new ShadowPlane("", scene, light, 100, 100, 256, 256 ) plane.setPriority( 100 ) plane.alpha = 0.2; scene.addChild( plane ) plane.setPosition(0,0,0); scene.camera.setPosition( 0, 200,50 ) scene.camera.lookAt(0,0,0); addEventListener(Event.ENTER_FRAME,update); } private function update(e:Event):void { physics.step(); light.x = Math.sin( getTimer() / 1000 ) * 200 light.z = Math.cos( getTimer() / 1500 ) * 200 light.y = 250 } } }