HierarchyWorldBoundBox and light in .node


Recommended Posts

I have a .node file that contains one mesh and one lightomni.

When I use the hierarchyWorldBoundBox, the size of the returned bounding box is the <shadow_distance>100</shadow_distance> of the lightomni ??
It's a bug or maybe I made something wrong ?

I use Unigine

Link to post

Hi Silent,

<?xml version="1.0" encoding="utf-8"?>
<nodes version="">
    <node type="ObjectMeshStatic" id="1679715438" name="apc/Light Fixtures/Indoor Luminaires/Bulbs/Modern Bulbs/E27 Screw Base/Bulb 500 Lumens 001">
        <surface name="screwcap_default9" material="684fc1172aa9eb8a1b62e5616e523f4cca40723b"/>
        <surface name="bulb_default8" material="2b45f3a7195fdcda4996067160a74d1c556305cb"/>
        <surface name="bottomceramic_default4" material="81219d488bd6a0077ac6ddba5c0a51d102f760fc"/>
        <transform>1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</transform>

        <node type="LightOmni" id="1733911815" name="LightOmni">
            <shape>0.01 0.01 0.01</shape>
            <color_filter>0.04 0.04 0.025 0.2</color_filter>
            <transform>1 0 0 0.0 0 1 0 0.0 0 0 1 0.0 0 0 0.12 1.0</transform>

I want only the boundingBox of the mesh not the light but when I write sceneNode->getHierarchyWorldBoundBox that return the size of shadow distance.

Link to post

hierarchyWorldBoundBox works as expected.
most likely you need something like this:

void getMeshBoundBox(const NodePtr & node, WorldBoundBox &bb)
	if (!node) return;

	int type = node->getType();
	if (type == Node::NODE_REFERENCE)
		getMeshBoundBox(static_ptr_cast<NodeReference>(node)->getReference(), bb);
	else if (type == Node::OBJECT_MESH_STATIC || type == Node::OBJECT_MESH_SKINNED || type == Node::OBJECT_MESH_DYNAMIC)

	for (int i = 0 ; i < node->getNumChildren(); i++)
		getMeshBoundBox(node->getChild(i), bb);

// and call it

	WorldBoundBox bound;
	getMeshBoundBox(node, bound);


Link to post

I know this is possible to get the bound box in this manner.
But I don't understand why the light return a bounding box because there is no vertexs in the light can you explain this choice ?

Link to post

In case of light sources the resulting bounding box is calculated from the attenuation distance (basically, the distance where the light is still emit something or the light size):


How to submit a good bug report
FTP server for test scenes and user uploads:

Link to post