How to remove an object3D from world?

Started by me520, March 15, 2010, 11:49:12 AM

Previous topic - Next topic

me520

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?

EgonOlsen

What's wrong with World.removeObject(...) !?

me520

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 ...

EgonOlsen

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.

me520


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 ^-^