Hi Fabrice, i can't understand where's the problem...
filter? where do I place the .3ds model, in bspCollider?
this is the code:
package
{
import away3d.cameras.lenses.PerspectiveLens;
import away3d.containers.View3D;
import away3d.core.clip.NearfieldClipping;
import away3d.core.render.Renderer;
import away3d.events.Loader3DEvent;
import away3d.graphs.bsp.BSPTree;
import away3d.loaders.AWData;
import away3d.loaders.Loader3D;
import away3d.loaders.Max3DS;
import away3d.physics.BSPCollider;
import flash.display.Sprite;
import flash.display.StageQuality;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.geom.Vector3D;
[SWF(frameRate = '30', backgroundColor = '0x000000', width = '800', height
= '600')]
/**
* ...
* @author Raphael Bruno Alves
*/
public class Main extends Sprite
{
private var bspCollider:BSPCollider;
private var view:View3D;
private var bspTree:BSPTree;
/**
* Constructor of the Application
*/
public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
/**
* Initialize the Application
* @param e
*/
private function init(e:Event = null):void
{
// Actions
removeEventListener(Event.ADDED_TO_STAGE, init);
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.quality = StageQuality.LOW;
// Events
addEventListener(Event.ENTER_FRAME, rendering);
// Creation
createEnvironment3D();
createMap();
createCharacter();
}
/**
* Create de Environment 3D
*/
private function createEnvironment3D():void {
view = new View3D({x: 400, y: 300, clipping: new NearfieldClipping()});
view.camera.lens = new PerspectiveLens();
view.camera.dof = true;
view.camera.x = -3850;
view.camera.y = 45;
view.camera.z = 85;
view.camera.rotationX = 0;
view.camera.rotationY = 90;
view.camera.rotationZ = 0;
addChild(view);
}
/**
* Create de Map
*/
private function createMap():void
{
var awData:AWData = new AWData();
awData.pathToSources = 'lib/3d/maps/';
var loaderMAP:Loader3D = new Loader3D();
loaderMAP.loadGeometry('lib/3d/maps/prision.awd', awData);
loaderMAP.addEventListener(Loader3DEvent.LOAD_SUCCESS, modelLoaded);
function modelLoaded(e:Loader3DEvent):void
{
bspTree = BSPTree(e.currentTarget.handle);
bspTree.usePVS = true;
view.scene.addChild(bspTree);
bspCollider = new BSPCollider(view.camera, bspTree);
bspCollider.testMethod = BSPTree.TEST_METHOD_ELLIPSOID;
bspCollider.flyMode = false;
bspCollider.maxClimbHeight = 60;
bspCollider.maxIterations = 4;
bspCollider.minBounds = new Vector3D(-70,-344,-200);
bspCollider.maxBounds = new Vector3D(102,50,100);
}
}
/**
* Create the characters
*/
private function createCharacter():void
{
var loaderCharacter:Loader3D = Max3DS.load('lib/3d/characters/jb.3ds');
loaderCharacter.x = -1620;
loaderCharacter.y = -300;
loaderCharacter.z = -95;
view.scene.addChild(loaderCharacter);
}
/**
* Rendering the scene in Real Time
* @param e
*/
private function rendering(e:Event):void
{
view.render();
}
}
}
2011/4/12 Fabrice3D <[email protected]>:
> looks like you have a filter applied... how do you add these models to the
tree?
>
> Fabrice
>
>
> On Apr 12, 2011, at 5:50 PM, Raphael Bruno wrote:
>
>> Hi all, the link...
>>
>> http://raphaelbruno.com.br/test_fps/
>>
>>
>> I'm using bsp to detect colision exported by preFab, it generate a file
.awd...
>>
>> The map works perfectly, the problem is when I add a .3ds model, the
>> ZShorting of .3ds model works so crazy.
>>
>> How I can solve this problem?
>>
>>
>> --
>> Raphael Bruno 2.0
>> 3Designer, Programador e Webdesigner
>> www.raphaelbruno.com.br
>
>
--
Raphael Bruno 2.0
3Designer, Programador e Webdesigner
www.raphaelbruno.com.br