ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperLicht
forum topic indicator getAllSceneNodesOfType('mesh'); in tutorial 3
person icon
bagg
Registered User
Quote
2010-10-17 10:05:36

I didn't found any function in the documentation for adding a bounding box to another or how to calculate the bounding box that contains the mesh buffers maybe you can point me on this please?

and another thing.In the tutorial 3 if we add:
var CheckSceneNode = engine.getScene().getAllSceneNodesOfType('mesh');
for (var j = 0; j < CheckSceneNode.length; j++)
{
if (CheckSceneNode)
{
alert ("OK");
}
}
It's not working which it means that it doesn't get the created mesh.
Why?

Thanks for your quick support.

person icon
niko
Moderator
Quote
2010-10-18 22:17:44

If you have one bounding box, you can add another one into it by calling yourbox.addInternalPointByVector(box.MaxEdge);
yourbox.addInternalPointByVector(box.MinEdge);

bagg wrote:
if (CheckSceneNode)
{
alert ("OK");
}


Maybe it would be correct with this?


if (CheckSceneNode[i])


person icon
bagg
Registered User
Quote
2010-10-19 09:18:11

Ok i'll have a look at the bounding boxes.
But with my other problem i changed the code with this

var CheckSceneNode = engine.getScene().getAllSceneNodesOfType('mesh');
alert (CheckSceneNode.length);

And the CheckSceneNode.length is zero

person icon
niko
Moderator
Quote
2010-10-19 17:30:22

Ah, you are starting with tutorial 3, now I understand. This will return nothing because the scene node you are creating in there is not a mesh scene node. It's an own one. Do it in the second tutorial for example, there you should get 3.

person icon
bagg
Registered User
Quote
2010-10-19 20:16:51

So if someone creates a custom scene node then he can't get the mesh?

person icon
niko
Moderator
Quote
2010-10-20 17:46:23

I think you've misunderstood something here. Of course you can get the mesh. If you wrote your own scene node, you already have the mesh. The getAllSceneNodesOfType function just goes through the scene and collects all scene nodes of a specific type. It works just like the document.getElementByTagName() thing. If you created your own HTML tag with an own name (e.g. 'mytag') and your own properties, you won't retrieve it either by calling document.getElementByTagName('div'),

person icon
bagg
Registered User
Quote
2010-10-21 08:55:23

I am sorry but isn't the created custom scene node type a "mesh" type?

person icon
niko
Moderator
Quote
2010-10-21 09:16:35

No, it's your own type. You derived it directly from the SceneNode type, the base class:
ySceneNode.prototype = new SceneNode(); // derive from SceneNode

Derive it from the MeshScene node and it is a 'mesh' scene node type.

person icon
bagg
Registered User
Quote
2010-10-21 12:14:28

Ah i see.So in order to get it with engine.getScene().getAllSceneNodesOfType('mesh');
i must change the
MySceneNode.prototype = new SceneNode();
to
MySceneNode.prototype = new MeshSceneNode(); right?

must i do any other changes to the rest of the code?

MySceneNode.prototype.OnRegisterSceneNode = function(scene)
{
scene.registerNodeForRendering(this, Scene.RENDER_MODE_DEFAULT);
SceneNode.prototype.OnRegisterSceneNode.call(this, scene); // call base class
}

MySceneNode.prototype.render = function(renderer)
{
renderer.setWorld(this.getAbsoluteTransformation());
renderer.drawMesh(this.MyMesh);
}

person icon
niko
Moderator
Quote
2010-10-21 17:14:50

Should probably work like that, yes.


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |