2 performance suggestions

What release are you using?  I think Mojo checked in a revamp to triangle related collision and picking long ago.  (Also, nightly builds have not been "nightly" or updated at all since April 19th '07)

i've been using 0.11 or the nighly build from april then. not sure.

i'll check if the current rc still created objects.

maybe it should be renamed annual build

TriangleBatch.getTrianglePick calls CollisionTreeManager for a collision tree. The collision tree obtained from the CollisionTreeManager should be cached unless you are exceeding the maximum cache limit each frame (and the tree remover starts trying to manage them). The cache clean-up is completely controllable by a custom tree remover. Just extend CollisionTreeController and set that as the tree remover. Other than that I don't explicitly see anywhere else that new objects would be created. What does YourKit tell you exactly?

It definitely could be rearranged.  It would still have to test for bounding type changes to keep the same behavior, but otherwise shouldn't be a problem.



While I go look at changing this, you might also look at your usage of update.  Ideally, updates should only need to be called at the root of a scene tree… and only once per update.  Given how many objects in your world are vegetation and other fairly "static" things, you should also be locking their bounds and updates as well  (on swaying vegetation you could set the manually set the local bounds to the full extents of where the plant could be during sway before you lock.)


Heh, actually… We already designed it to reuse…  was just missing a "this.".  Will check that in.

my game works differently. i cannot call updategeometricstate once per frame, and i never call it on the root :slight_smile:



all objects are contained within several nodes by sorted type/collision type/visible range/something else - it simplifies the game logic and handling a bit. i never call updategeometricstate for the nodes containing only static objects, so this is no problem here.

for the moving objects, i have to call it several times per frame because there may be more than one influence moving the entites, and some of them are dependend on the movements other influences make before them. for example, after the gravity made it's influence, i have to update the modelbounds because the next influence checks for objects below the actors feet. if i do not update the worldbounds, the actor changes his position to "above the objects" to "slightly inside the objects" and back every frame. (of course, i only call it IF there are several influences)



edit: where to put the this.?



edit edit: my guess was right. everything is clearly smoother now :slight_smile:

I still sounds less than ideal, but that's just imho.


worldBound = child.getWorldBound().clone(this.worldBound);