BoxPrimitive in Component-Constructor?

Feb 27, 2010 at 11:19 AM

Hi,

I'm currently having issues with objects getting clipped much too early when rotating the camera. 
I believe this has something to do with die IPrimitive-argument within the SceneComponent's Constructor. So far I've always typed "new BoxPrimitive()" for that field - my guess is that this only creates a much too small Primitive to resemble the Object's Bounding Volume.

So I tried to change the Primitive after the Object was created (because I only then know, how big it is and how much space it's volume contains).... but I found no way to change the Primitive after an Object's creation by the Constructor :-(

Know I worked around that problem by first creating a temporary object, then calculating it's boundingBox and then replacing the temporary Object with a new Object - with the calculated BoundingBox in it's constructor.
But I doubt this is really the intended way to go. 

looking like this in my Code:

 

 LevelModel tmp = new LevelModel(engine, domainName, ownedByDomain, new BoxPrimitive(), modelFileName, textureFileName, 0);
                    tmpLevelModel = new LevelModel(engine, domainName, ownedByDomain, new BoxPrimitive(ModelService.getModelBBox(tmp)), modelFileName, textureFileName, 0);      
LevelModel tmp = new LevelModel(engine, domainName, ownedByDomain, new BoxPrimitive(), modelFileName, textureFileName, 0);
tmpLevelModel = new LevelModel(engine, domainName, ownedByDomain, new BoxPrimitive(ModelService.getModelBBox(tmp)), modelFileName, textureFileName, 0);

 

 

 

 

Coordinator
Mar 1, 2010 at 1:15 AM

Use the TrySetBoundingBox() method instead.

Cheers!