Simple rotation problem

Blitz3D Forums/Blitz3D Programming/Simple rotation problem

Nmuta(Posted 2006) [#1]
I have a puzzle piece (think: 3d tetris)
that needs to be rotated according to absolute space, on a grid.

Usually I use RotateEntity for something like this, but that only works on one axis for this model. I think it has to do with the actual pivot of the model. I also tried turnentity(false and true, both). No luck.

At any rate, I've tried creating a pivot, translating the pivot out a bit, and then using DeltaPitch between the two points, I've also tried AligntoVector with various permutations of those parameters, yet still I cannot get the piece to rotate on it's local x axis without suddenly appearing several units off to the right.

What's the better approach for this?

the main problems is that it does turn but it turns WAAAY off the axis I need it to be on, as if the pivot were off. And I checked the model in the 3d app I made it in and the pivot is right in the center of the model.


b32(Posted 2006) [#2]
I think you are right about the pivot. Maybe the piece needs to be centered around it's own (0, 0, 0) to rotate correctly. Try using: FitMesh piece, -1, -1, -1, 2, 2, 2, 1. Note that fitmesh scales the mesh as well, but there are a several ways to center the mesh without scaling it.


Nmuta(Posted 2006) [#3]
Yeah, I cannot use fitmesh, because all of the pieces fit on the same grid, and I cannot deal with the distortion. I'm learning that precision based puzzle games in 3d are much more work than free roaming 3rd and first person or driving games, where 100% precise floating point accuracy is not as critical.


b32(Posted 2006) [#4]
Maybe you could use integers ? I would try and keep the puzzle as much 'data' as possible. I mean, building the program so, that rendering the scene in 3d is not necessary for the game to work correcly.



Nmuta(Posted 2006) [#5]
b32, that's a useful function. I've never used the PositionMesh command either. I may have to use that.

Also, I think you're right about using integers. Really, I'm thinking the only way to really successfully do this is by using using multidimensional arrays and have each piece also have it's own local array, and have to fit into the larger one. Which is quite a bit of matrix math.