Author Topic: How to remove an object3D from world?  (Read 2881 times)

Offline me520

  • byte
  • *
  • Posts: 10
    • View Profile
How to remove an object3D from world?
« on: March 15, 2010, 11:49:12 am »
If we want to add an object3D into world we can do this :

World world = new World();
Object3D model1 = ...
Object3D model2 = ...

world.addObject(model1);
world.addObject(model2);

now,if we wang to remove model2 from world , how can we do?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: How to remove an object3D from world?
« Reply #1 on: March 15, 2010, 12:01:43 pm »
What's wrong with World.removeObject(...) !?

Offline me520

  • byte
  • *
  • Posts: 10
    • View Profile
Re: How to remove an object3D from world?
« Reply #2 on: March 16, 2010, 01:28:29 pm »
I'm again ,my first question is bad in forum...

I need to take more time to learn JPCT API

now,i'm in trouble again... ~.~

in the JPCT Car demo, in CarTest.java

class CarTest {
...
car=new Car();
car.translate(55, 0, 55);
car.addToWorld(theWorld);
...
}
the car was loaded in this coordinate (55, 0, 55)

then i move the car ,the car's coordinate has changed

i create a method to output the car's coordinate
i use System.out.println("XAxis="+car.getXAxis())  and System.out.println(car.getZAxis())
but output is like XAxis=(****,0,****)   YAxis=(****,0,****)

i want to get the result like XAxis=****   YAxis=****

how to do ?Maybe something is wrong i did ...
 

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: How to remove an object3D from world?
« Reply #3 on: March 16, 2010, 05:02:01 pm »
get?Axis() always returns a vector. You can't describe an axis by a scalar. However, i don't think that get?Axis() is what you want. If you want the car's coordinates, something like car.getTranslation() or car.getTransformedCenter() might by more suitable.

Offline me520

  • byte
  • *
  • Posts: 10
    • View Profile
Re: How to remove an object3D from world?
« Reply #4 on: March 17, 2010, 04:04:55 am »

Thanks!
Useful info!

you are right,i want to get the car's coordinates.

now i'm writing a network demo for interests based on JPCT Car,I write a method to send local client's coordinates to srever.

car.getTranslation() or car.getTransformedCenter() ...........let me try ^-^