• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
WiredCat

Positioning rotated alieron (torque rotation)

5 posts in this topic

[img]https://sites.google.com/site/imoomohomozumo/home/F-18-3view.jpg[/img]

Look at this image.
The thing is i want to find new position of the blue dot if i rotate aircraft

I start from positioning the center of an aircraft then i move whole model to geometric center (red dot)
i already have fixed airframe (alieron) position so i know where to translate it when no rotation is applied. But then rotation appears:

I know the front direction of an aircraft, its up direction and its right direction, but i have strange feelings about my solution so i ask here:
I want to do something like this:
- go to red dot
- multiple vector AB X value by normalized right direction
- multiple vector AB Y value by normalized up direction
- multiple vector AB Z value by normalized front direction

and here is the deal i think this will position the airfoil in the right direction but with wrong distances? am i right what i need to do? [img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img] Edited by ___
0

Share this post


Link to post
Share on other sites
Your solution should involve rotating the aircraft by using a specific rotation matrix, or packing that same rotational information into a full transform matrix. Really, I think all the operations you describe above are concatenations of matrix transformations (both translations and rotation matrix operations combined together).

You should be able to use the same matrix to rotate and/or transform (meaning rotate and translate) the aircraft and apply the same to the blue dot in order to find the transformed position of it.

If you want to animate the ailerons then you'll want to rotate the aileron first about it's own local axis in order to deflect them as a real aircraft would in response to a stick input and then apply the aircraft transformation to it afterwards in order to position and orient it correctly on the aircraft. This can again be concatenated into one matrix transformation. Edited by freakchild
0

Share this post


Link to post
Share on other sites
Yeah that is quite simple : ) I will check it in the near future, because i need to create airplane model, code cameras etc. but it looks like the answer to my problem :)
I only have a question about rotating using opengl ( i don't have much time i prefer to code something else rather than check it ;p ) if i have alieron center position not in 0,0,0 but in x,y,z and if i want to rotate(glrotate)it by X,0,0 or 0,Y,0 0,0,Z axises i just need to transalte it to 0,0,0 point ( -x,-y,-z)

and second question: you have told me that i need to rotate it by local axis then just multiple matrices [ alieron with airplane modelview (simple glMultMatrixf) ] right? this should do the work?
0

Share this post


Link to post
Share on other sites
[quote name='___' timestamp='1349357244' post='4986754']
i have alieron center position not in 0,0,0 but in x,y,z and if i want to rotate(glrotate)it by X,0,0 or 0,Y,0 0,0,Z axises i just need to transalte it to 0,0,0 point ( -x,-y,-z)
[/quote]

Yes, that sounds right. Translate by (-x,-y,-z) and then do the rotations you need, then translate by (x,y,z) in order to put it back in place.

[quote name='___' timestamp='1349357244' post='4986754']
and second question: you have told me that i need to rotate it by local axis then just multiple matrices [ alieron with airplane modelview (simple glMultMatrixf) ] right? this should do the work?
[/quote]

glMultMatrix along with glRotate, glTranslate and so on, operating on the modelview matrix can work yes but do bear in mind that all these functions apply operations to the 'current' matrix, which will be determined by glMatrixMode and whatever you initially loaded by glLoadMatrix.

While that version of the API has handy functions like glPush/PopMatrix which can help too it can get a little cumbersome and difficult to debug, especially if you're new.

As an alternative many people do author or use a matrix library, working outside of opengl first and then submitting the final results to the GL_MODELVIEW matrix via LoadMatrix. This can offer a little more flexibility as far as manipulating matrices goes and can help in understanding things.
0

Share this post


Link to post
Share on other sites
no worry i am rather advanced ;] just want to be sure before writing ; P tommorow i will check it, just need to scale model and add a new class, that ?will?be using aircraft and airlierons and other things, i forget many things because i drink too much beer o:! it is good to ask someone else rather than cdoe carp and then figuring whats wrong (read as know what is wrong but how to fix it )[img]http://public.gamedev.net//public/style_emoticons/default/tongue.png[/img] god bless you ;d;d;d enough of this crap over and out! :X Edited by ___
0

Share this post


Link to post
Share on other sites
Now i have this:


[media]http://youtu.be/IfjROPkTTAM[/media]



and i use this:


[CODE]
not important stuff like drawing jet model
glPushMatrix();
glLoadIdentity();

gluLookAt(kold.x,kold.y,kold.z,kold.x+ksp.x,
kold.y-ksp.y,kold.z-ksp.z,0,1,0); //camera dude
glDisable(GL_DEPTH_TEST);//only to see the airlieron
glColor3f(1,0,0);
glTranslatef(PHYSIC_MODEL->AIRLIERON_LEFT->model->CENTER_POINT.x,PHYSIC_MODEL->AIRLIERON_LEFT->model->CENTER_POINT.y,PHYSIC_MODEL->AIRLIERON_LEFT->model->CENTER_POINT.z);
glRotatef(PHYSIC_MODEL->AIRLIERON_LEFT->pitcha,1.0f,0.0f,0.0f);
glTranslatef(-PHYSIC_MODEL->AIRLIERON_LEFT->model->CENTER_POINT.x,-PHYSIC_MODEL->AIRLIERON_LEFT->model->CENTER_POINT.y,-PHYSIC_MODEL->AIRLIERON_LEFT->model->CENTER_POINT.z);

glMultMatrixf(PHYSIC_MODEL->YPRangle.AIR_MATRIX);

PHYSIC_MODEL->AIRLIERON_LEFT->model->DrawSimpleModel();
glEnable(GL_DEPTH_TEST);
glPopMatrix();
[/CODE]


I will explain some things

i have an airlieron model in position (CENTER_POINT [x,y,z] i don't know what is the center but i do now that is not 0,0,0 ;x)
so in order to simple rotate for test purposes i do [opengl uses stupid ordering ;P]
i translate airlieron to 0,0,0 point, then i am rotating it and then translating to its position, then i apply JET matrix as seen above.
Any suggestions to make it work ?:X




[b][color=#ff0000]SOLVED. The thing was that i called glMultMatrixf last instead of first x_X right after glulookat[/color][/b] Edited by ___
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0