The preparations that need to be made are as follows:
1,flex SDK Hero
2,flash Player 11,0,0,58 Incubator
3,playerglobal.swc
4,flare 3D 2.0
Then follow these steps to create the project:
Install the Flex SDK Hero
Please download hero Build 19786
Copy the downloaded Hero (version 19786) to the installation directory of the Flash Builder and name:
[Flash Builder installation directory]/sdks/4.5_incubator
here , download the PLAYERGLOBAL.SWC to develop the incubator project, and then put PLAYERGLOBAL.SWC in this address:
[Flash Builder installation directory]/SDKS/4.5_INCUBATOR/FRAMEWORKS/LIBS/PLAYER/11.0/PLAYERGLOBAL.SWC
Please come here for information about incubator and download the installation, which is a preview of Flash Player 11 and the installation method is equivalent to previous Flash Player updates.
Open the Flash Builder and create a new ActionScript project.
Right-click the item name and go to the Properties panel and select ActionScript Compiler in the list on the left. Then click on "Configure Flex SDKs" in the upper right corner
Click Add to add a Flex SDK and fill in the newly created SDK path to determine.
Also in ActionScript Compiler, select the SDK you just added in the Flex SDK version above, and then fill in a new parameter in the additional Compiler arguments below:-swf-version =13
Download the install Flare 3D Development Framework
Please sign up here and get the Flare 3D 2.0 development Framework for FREE
Copy all the contents of the Bin folder to the Bin-debug folder in the newly created project, including the textures and 3D model files used by the example, and copy all the contents of the examples folder (a bunch of as files and two packages) to the project's default package:
OK, now we can open the example from the Flare 3D download package, in Src/default package test01-test14 each is a small example, including
how to import DAE and UV map modeling, how to create animations, Particles and how to increase mouse control and collision detection , and so on. Be sure to try Ah, because the hardware acceleration enabled, the experience is very smooth.
It is also very simple to look at from the code, here I give a import model and map of the code, unexpectedly only a few lines:
//指定贴图的路径
ColladaLoader.texturesFolder = "textures";
//导入模型
scene = new Viewer3D( this, "car.dae" );
scene.camera.setPosition( 0, 0, -150 );
To import Dae and map effects:
The case for collision detection is also not complicated:
Private Function Completeevent (e:event): void
{
Define a collision detection set
collisions = new Spherecollision (player, new Vector3D (0, 15, 0));
Set Collision level
Collisions.addcollisionwith (level);
Add Refresh Event Listening
Scene.addeventlistener (Scene3d.update_event, updateevent);
}
Private Function Updateevent (e:event): void
{
Keyboard Control villain Movement
if (Input3d.keydown (input3d.right)) {Player.rotatey (5); player.framespeed = 1;}
if (Input3d.keydown (Input3d.left)) {Player.rotatey (-5); player.framespeed = 1;}
if (Input3d.keydown (input3d.up)) {Player.translatez (4); player.framespeed = 1;}
if (Input3d.keydown (Input3d.down)) {Player.translatez (-4); player.framespeed =-1;}
After the keyboard is pressed, the little ones play The walking animation
if (Input3d.keydown (input3d.up) | |
Input3d.keydown (Input3d.down) | |
Input3d.keydown (input3d.left) | |
Input3d.keydown (Input3d.right))
Player.play ();
Else
Player.stop ();
Add the gravitational acceleration
PLAYER.Y-= 3
Collision detection
Collisions.slider ();
/**** control Camera Tracking ****/
Set the camera position to follow the little ones.
Pivot3dutils.setpositionwithreference (Scene.camera, 0, -600, Player, 0.1);
Set the camera lens on the little ones.
Pivot3dutils.lookatwithreference (scene.camera, 0, 0, 0, player);
}
Collision Detection Paradigm Map
The downloaded Flare 3D package also includes a set of API development documents, which, while not detailed enough in English, should meet the needs of the first step and believe that as the framework continues to evolve, these development documents and the enthusiastic masses in the community will provide us with more detailed information.
Finally, one thing is particularly important, please modify a value before publishing, open html-template/index.template.html,
Add a line of code on the next line of call Params.allowfullscreen = "true"
Params.wmode= "Direct";
If you do not set this, then the hardware acceleration function will not be turned on, if you are using flash develop or Flash Pro to test incubator, you must not forget this item.