Problem with aligning mesh to world (normals)
BlitzMax Forums/MiniB3D Module/Problem with aligning mesh to world (normals)
| ||
Hi, I have a round ish world like super mario galaxy, and my little man needs to basically align to whatever he walks on. I use linepick from the little man to the middle of the world then move him to the middle of the world. This works but I can't figure out how to align him to it and AlignToVector simply isn't working... I searched the forums and AlignToVector isn't implimented in minib3d (I will be using iMini eventually) So does anyone have the basic code to align a mesh pitch and yaw, to normals? Thanks a lot |
| ||
This is exactly what I want to do (click to play flash demo) http://pv3d.org/2008/11/29/using-slerp-to-move-around-a-sphere/ Problem is I can't really use quats or custom code as I need to make the pc/mac version compatible with iminib3d... Last edited 2010 |
| ||
http://www.gamasutra.com/view/feature/3593/games_demystified_super_mario_.php b3d code included on seconde page! |
| ||
hi, my own code is almost identical, except AlignToVector does not work in iminiB3D so i need to demystify aligntovector :) thanks for the post though, it proves I am on the right track! |
| ||
Just need to get a simple version of AlignToVector (2) working on C++ and blitzmax (which means no hacked stuff with matrixes) This is what I have: Function Align(entity:TEntity, vx:Float, vy:Float, vz:Float) Local pitch#=Abs(EntityPitch(entity)) Local yaw#=Abs(EntityYaw(entity)) Local dest_pitch#=Abs(ATan2(vz#,vy#)) Local dest_roll#=Abs(-ATan2(vx#,vy#)) RotateEntity(entity, pitch#, yaw#, roll#) End Function But unfortunately at upside down angles it has wrong normals or something as it flips. Help please? Last edited 2010 |
| ||
Ah, well maybe Warners minib3d version will help? It's got matrices and aligntovector as i recall. It's in the code archives i think. Cheers Charlie |
| ||
Here is si's version but its broken/borked when upside down of the planetoid. http://www.blitzbasic.com/Community/posts.php?topic=65425 |