if i want to delete the Object3D,which way better fps?

Started by Uncle Ray, October 13, 2014, 07:21:54 AM

Previous topic - Next topic

Uncle Ray

SOLVED THX EGO





in my project,i want to create a missile,when it hit the target,it must be disappear.
i set the missile to Object3D.
Here is some ways:
1.
missile.clearobject;

2.
world.removeobject(missile);

3.missile.setvisbility(fasle);

which way is better fps?


And more,if i want object invisibility,which way is better fps?
1.setvisibility(false);
2.setTransparency(0);
3.settexture("trans"),
the"trans" is a transparent png,so the object would be invisibility.



Thx ego


EgonOlsen

clearObject isn't meant to used that way. If setVisibilty() or removeObject() is better depends on the way in which you plan to use these missiles. If you are going to reuse them, setVisibility() might be better. If you fire them only a few times and it never happens again, removeObject() might be better.
To make something invisible, use setVisibility() unless the invisible object is still a valid game entity, like a cloaked missile.

Uncle Ray

thx,ego,got it ,setvisibility is the best_way,thx,thx ;D