translation and removing, replacing objects

Started by fireside, March 08, 2008, 04:04:26 AM

Previous topic - Next topic

fireside

1.  Is there a way to move the object back to zero,zero,zero so you can translate in world space?  Once an object has been moved it gets confusing to place it in world space.

2.  What do you recommend for removing an object and putting another in it's place?

3.  There are some things in javadoc about getOrigen(), setOrigen() could this be used to reset objects to their initial positions?  I would like to reset all objects to their initial position, I guess that means I don't want to actually destroy the objects that will be replaced with other objects.

click here->Fireside 7 Games<-

EgonOlsen

#1
To reset them, simply do:


obj.setTranslationMatrix(new Matrix());
obj.setRotationMatrix(new Matrix());


setOrigin(...) is meant as an offset that doesn't affect child objects in its translation. It's not meant to reset objects in space.

To replace an object with another one at the same position with the same coordinates, do something like:


newObj.setTranslationMatrix(oldObj.getTranslationMatrix().cloneMatrix());
newObj.setRotationMatrix(oldObj.getRotationMatrix().cloneMatrix());


That should do the trick.

fireside

O.K.  Thanks, I'll check those methods out.
click here->Fireside 7 Games<-