axis help?
Blitz3D Forums/Blitz3D Beginners Area/axis help?
| ||
I am trying to convert a program from c++ to blitz, and am doing a good job, but the program uses a different coordinate system than what Blitz uses. Lucky for me, it has a comment that says that the y axis points left, the z axis points up, and the x axis points into the screen. It also says that it has to convert this axis system from this to DirectDraw's coordinate system, which sounds like blitz's. It just says: ...//screen x = -y simulation //screen y = z simulation //screen z = x simulation How would I go about converting the angles? (what i have done doesn't work, which is exaclty what it says, the same as for direction.) This is probably silly, but can someone help? |
| ||
It is the common axis system used by many app => like 3dsmax . you have to operate a -90° rotation on z axis ( from the original axis system ) then a +90° rotation on X axis ( from the original axis system ) , and you'll get the Blitz3D axis system. But if you want to convert all the original C++ program, maybe you should just use a main pivot that will be parent from all entitys in the scene. you rotate it from local axis to global axis using the pitch and roll i mentioned, and them, everything will be restored. ( but maybe it's not the best way... ) |
| ||
Thanks bobysait, do I need to do anything for the y axis, or do I just leave it alone? Also, does the z axis (and x) stay the z axis or does it change? The c++ sim has only one entity, nothing to worry about... |
| ||
RotateEntity(ent,0,-90,0)? |
| ||
Sorry guys, but I am not quite understanding this. I have tried to implement both of your ideas but have not been able to do so. RotateEntity entity\yRot,entity\zRot-90,entity\xRot+90 doesn't seem to help... |
| ||
x axis points front => should be z y axis points left => should be x z axis points up => should be y Maybe RotateEntity entity\yRot, entity\zRot, entity\xRot ? |
| ||
Bram, your way works except the picth(my x, sim y) is reversed. It seems to work with negative y: RotateEntity entity\mesh, -entity\yRot, entitity\zRot, entity\xRot But after tumbling and spinning a bit, the y becomes reverse (this might be a different problem) |
| ||
Have you tried setting the optional [global] parameter for RotateEntity to 1 ? |
| ||
It has always been set to true. I think the problem is that I need to figure out how apply the -y axis to the pitch... |
| ||
Hmm, and what if you replaced every "x" in the program by "y" and "y" by "z" and "z" by "x" ? And is it only the "Y" that gets reversed after a while ? Does it get negative ? Are there any ^2 or ABS() operators used ? Or is the Y-angle affected by the other 2 axis ? |
| ||
Only the y gets reversed, and all of the axis affect each other, meaning the x determines how much the y is and the z also determines how much the y is. (blitz coords)...The x axis should not be touched by the others, but affect the others. I guess what I am really looking for is a sure way to convert between the axis, because I cannot tell if it is right or if there is a bug. I need to know that the axis conversion stuff is right, and can't think of a way to figure it out. |