Point entity gimbal lock...
BlitzMax Forums/MiniB3D Module/Point entity gimbal lock...
| ||
I'm using Warners matrix-ified version of miniB3d, which seems better when it comes to rotating things, but it seems as if pointentity is still suffering from gimbal lock. Is there any way to fix this? Turnentity seems fine, so i'm guessing it's possible, right? Cheers Charlie |
| ||
Maybe you can replace it with AlignToVector?function pointentity2(source:Tentity, target:TEntity) dx = entityx(target,1)- entityx(source,1) dy = entityy(target,1)- entityy(source,1) dz = entityz(target,1)- entityz(source,1) aligntovector2 target, dx, dy, dz, 3, 1.0 end function |
| ||
Fantastic! Thanks Warner, i'd not thought of doing that :) Also, it's worth noting that because i'm trying to point the camera at the object, i had to use negative dx,dy and dz otherwise the camera would face outwards! Now to work out how to make the players movements relate to the orientation of the camera... Cheers Charlie |
| ||
Normally, using: TFormVector 0, 0, 1, Null, camera TranslateEntity obj, Tformedx(), Tformedy(), Tformedz() should do that. However, it also seems to be inverted. Unf., I have no time to look into the problem. Could be due to that fact that camera's use an inverted matrix? |
| ||
In OpenGL the Z axis is flipped. |
| ||
I'll post my code later. I got camera relative controls in already :) Tformvector is pretty cool! I'm still having a little trouble getting my model to rotate to the direction i'm pressing on the keyboard/joystick. I'm guessing i need to work out how to rotate around a normal?! Cheers Charlie |
| ||
Ah, well in the modded version, there is a function called MQ_Turn. It takes an axis and a degree. It is a method of TEntity. Last edited 2011 |
| ||
Thanks, i'll take a look at MQ_Turn :) Cheers Charlie |
| ||
Ah, i think MQ_Turn is exactly what i need! I hadn't noticed it before, i needed to refresh Blide's module database for the function to show in autocomplete. Cheers Charlie |