K, so I just made a test using latest svn version
--> adding meshes and set collider true works
I honestly do not understand what you are doing, I have just made a test using
either as3 classes from Prefab and using primitives:
both work.
if you have a class, simply loop over the meshes array and add to tree.
only thing I can think of, is that you add either outside the tree, or that
your camera is inside some collider bounds
for the last one, make this test:
compile with NO meshes added, go with the camera at a place you know for sure
there are no objects added
right click on scene, select camera tab, and look at camera position.
enter in your code where the default camera position is set this position
now add your meshes and make sure the bounds of collider is correct, depending
on scale of your world, you need to adjust
it often result in practice to either no be possible to move the camera or not
be able go everywhere.
on my tests, using the bunker model, it simply works.
here one test with a cube
private function initAway3D():void
{
_view = new View3D({x: stage.stageWidth*.5, y:
stage.stageHeight*.5, clipping: new NearfieldClipping()});
_view.camera.lens = new PerspectiveLens();
_view.camera.zoom = 6;
_view.camera.x = 500;
_view.camera.y = 1000;
_view.camera.z = 1400;
_view.camera.rotationX = 0;
_view.camera.rotationY = -90;
_view.camera.rotationZ = 0;
_tree = BSPTree(AWData.parse(new BSPFile()));
_view.scene.addChild(_tree);
_tree.usePVS = true;
_bspCollider = new BSPCollider(_view.camera, _tree);
_bspCollider.testMethod = BSPTree.TEST_METHOD_ELLIPSOID;
_bspCollider.flyMode = _flightMode;
_bspCollider.maxClimbHeight = 50;
_bspCollider.maxIterations = 4;
_bspCollider.minBounds = new Vector3D(-80,-200,-80);
_bspCollider.maxBounds = new Vector3D(80,40,80);
var cube:Cube = new Cube({width:40, height:40,
depth:40});
cube.x = 100;
cube.y = -1200;
cube.z = 100;
cube.addOnMouseDown(bla);
cube.collider = true;
_tree.addChild(cube);
addChild(_view);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function bla(e:MouseEvent3D):void
{
trace("bam click click!"); --> is not triggered
}
--> now, what indeed doesn't work is mouseEvent3D
will look into it asap
Fabrice
On Nov 24, 2010, at 9:06 AM, le_unam wrote:
> Hey Fabrice, in another Thread you said, that objects like doors,
> chairs, tables etc should be added to the tree after using the bps
> generator and set collider = true. thats all i have done, but this
> doesnt work when adding an object from prefab as as3-file. the object
> is added to the tree and shows up but doesnt collide. can you please
> help me :)
>
> On 23 Nov., 12:54, le_unam <[email protected]> wrote:
>> hmm now i did it with the for-"function" and the whole object is
>> shown, but the collision detection doesnt work. i tried
>> object.collider = true; and i also tried object.meshes[i].collider =
>> true; nothing works.
>>
>> On 23 Nov., 12:39, le_unam <[email protected]> wrote:
>>
>>> hey fabrice, thank you ... this works good, but now only one mesh of
>>> my object is shown. is there a way to automatically add all mehses of
>>> the object or do i have to find out how many meshes my object does
>>> have and do it with for(....){ .... } ??
>>
>>> On 23 Nov., 12:20, Fabrice3D <[email protected]> wrote:
>>
>>>> If you have exported the AS3 from Prefab
>>
>>>> var holder:PrefabClass = new PrefabClass();
>>>> _tree.addChild(holder.meshes[0]); //the as file meshes array contains ONLY
>>>> meshes
>>
>>>> Make also sure the model is IN the bounds of your tree model, if you add
>>>> the model outside the "walls" or if a part of it is outside
>>>> it will probably not be considered for render.
>>
>>>> Fabrice
>>
>>>> On Nov 23, 2010, at 10:58 AM, le_unam wrote:
>>
>>>>> Hey, did anyone successfully add an obj oder as3 export from prefab
>>>>> into the bsp tree?
>>>>> i still have the problem that my obj only shows up when adding it to
>>>>> _view.scene but not _tree.
>>>>> i know that the bsp tree is not able to show objectcontainer3d, but
>>>>> i`m nearly sure that my obj is no objectcontainer3d. how can i trace
>>>>> the type of my object?
>>
>>>>> greets manu
>>
>>>>> On 22 Nov., 12:43, Tony Brown <[email protected]> wrote:
>>>>>> thanks for the link this will help me :)
>>
>>>>>> On Thu, Nov 18, 2010 at 3:52 PM, John Wilson <
>>
>>>>>> [email protected]> wrote:
>>>>>>> Hi,
>>
>>>>>>> Look at:
>>
>>>>>>> http://john-wilson.110mb.com/bsp_tutorial/bsp_tutorial_index.html
>>
>>>>>>> the ActionScript part of the tutorial may help.
>>
>>>>>>> Regards,
>>
>>>>>>> John Wilson
>>
>>>>>>> On Nov 18, 2:12 pm, le_unam <[email protected]> wrote:
>>>>>>>> the code i use in my main class for adding my obj file is the
>>>>>>>> following:
>>
>>>>>>>> import away3d.loaders.MyMan;
>>
>>>>>>>> private var superMan:MyMan;
>>
>>>>>>>> superMan = new MyMan(10);
>>>>>>>> _tree.addChild(superMan);
>>
>>>>>>>> is this the correct way to add objects or did i something wrong?
>>
>>>>>>>> On 18 Nov., 13:19, le_unam <[email protected]> wrote:
>>
>>>>>>>>> Hey ... i tried a little bit with adding an obj to the bsp tree and it
>>>>>>>>> doesnt work for me ^^
>>
>>>>>>>>> the model is shown when i take _view.scene.addChild but not when
>>>>>>>>> adding to the tree _tree.addChild. I searched in this forum and found
>>>>>>>>> that i should load the obj into prefab and export an as3 file. i did
>>>>>>>>> this and imported the class into my main class but then it is the same
>>>>>>>>> issue. the model is only shown when adding to _view.scene, but not to
>>>>>>>>> the tree.
>>
>>>>>>>>> any ideas? = /- Hide quoted text -
>>
>>>>>>>> - Show quoted text -