cloneObject() and setRotationPivot - what's wrong?

Started by Klaudiusz, June 29, 2007, 09:17:44 PM

Previous topic - Next topic

Klaudiusz

Hi,

I have the source object and i just use cloneObject(). Everything is OK until i use simply setRotationPivot(new SimpleVector(0, 0, 0)) for each of them. The source object is modified OK, but there is no difference in cloned object behaviour. Should i use some additional method for clone the object?

Thank You in advice.

EgonOlsen

The rotation pivot isn't related to cloning in any way...but i'm not quite sure what you want to achieve and what you are getting instead. Maybe a little code snippet can help to illustrate the problem?

Klaudiusz

#2
Yes, ofcourse.

Have a look at my source test object:




Well i have defined SourceObject and i clone him:


....
ClonedObject= SourceObject.cloneObject();
SourceObject.build();
ClonedObject.build();
theWorld.addObject(SourceObject);
theWorld.addObject(ClonedObject);


The result can You see below. Both object are transparenced, rotated by X Angle:






But the result is bad because i had no centered object. I have to use the Pivot:



....
ClonedObject= SourceObject.cloneObject();
SourceObject.setRotationPivot(new SimpleVector(0, 0, 0));
ClonedObject.setRotationPivot(new SimpleVector(0, 0, 0));
SourceObject.build();
ClonedObject.build();
theWorld.addObject(SourceObject);
theWorld.addObject(ClonedObject);



The same situation, maybe little differend camera only:






My Souce Object is rotated correctly (his one end stay in the same place), but ClonedObject behaviour has not changed...


EgonOlsen

build() resets the rotation pivot (not mentioned in the docs for build() but in the part about setRotationPivot()). So you should change the order. However, that doesn't explain why the pivot seems to be different on the cloned object (or am i fooled by the perspective here?). If not, then what are the rotations pivots of both objects after calling build()?

Klaudiusz

I used setRotationPivot after build .... everything is OK! :)

Thank You