Rotation of asymmetrical 3ds object problem

Started by Cowbox, February 02, 2012, 06:24:32 AM

Previous topic - Next topic

Cowbox

Well I can't be setting it on clones for this object.

I made sure of that by only using wall1 for this purpose; the rest of the engine is being handled elsewhere and isn't being touched.

That's the complete code up there for wall1^, and I'm definitely calling build. :S

I've also tried loads of combinations of build before and after setting the pivot, not building at all, rebuilding, unbuilding.

Nothing's making any difference, the pivot still comes out at 5,0,5 regardless. :S

EgonOlsen

(5, 0, 5) isn't the pivot that build() calculates...that would be (-4.757353, 1.4024623E-7, 4.757353). If you still get (5, 0, 5), you are setting this somewhere in your code after setting it to (0,0,0) and before calling getRotationPivot(). Just check for references in your code to setRotationPivot() and you should find it somewhere, long lost and forgotten.

Cowbox

#17
Lol my code's really not that long at all...

I've already pasted everything I'm doing to wall1 in this thread.

I wasn't using setRotationPivot until before you started telling me to, so the only places it's going to be are either on the engine related props (which I'm pretty sure I subsequently removed) or on the 4 walls I've used to show this problem.

Here's a big paste of the entire code if it makes any headway on this. xD
http://slexy.org/raw/s2mXZOlk3r

There's only one other source file and that's for handling sound. (I haven't managed to make the engine any more streamlined because of problems like this getting in my way every 10 lines xD)

Extra:
Just realised I've left the pivots set to -6,0,-6 in that but I can assure you, the console output is still reading 5,0,5 regardless of whatever I put in there... xD

And here's a picture showing just that:

EgonOlsen

Remove (or relocate) this call: 

world.buildAllObjects();

It calls build() on all objects...again. And that resets the pivot.

Cowbox

Aha! xD

Finally, we've found the problem.

I knew it'd be something derpy like that. :D

Thanx, now I can go make stuff :D:D:D:D