Author Topic: if i want to delete the Object3D,which way better fps?  (Read 945 times)

Offline Uncle Ray

  • int
  • **
  • Posts: 81
    • View Profile
if i want to delete the Object3D,which way better fps?
« on: October 13, 2014, 07:21:54 am »
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
« Last Edit: October 20, 2014, 02:50:16 pm by Uncle Ray »

Offline Uncle Ray

  • int
  • **
  • Posts: 81
    • View Profile
Re: if i want to delete the Object3D,which way better fps?
« Reply #1 on: October 14, 2014, 12:42:18 pm »
Any helps will be appreciated.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11985
    • View Profile
    • http://www.jpct.net
Re: if i want to delete the Object3D,which way better fps?
« Reply #2 on: October 14, 2014, 01:01:40 pm »
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.

Offline Uncle Ray

  • int
  • **
  • Posts: 81
    • View Profile
Re: if i want to delete the Object3D,which way better fps?
« Reply #3 on: October 14, 2014, 01:21:58 pm »
thx,ego,got it ,setvisibility is the best_way,thx,thx ;D