• 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
Stephany

Correct Positive Rotation Directions

2 posts in this topic

I'm having some trouble understanding the "correct" direction to rotate in 3D for a positive angle on each axis. Some of this may come down to convention (?), and if so, I suppose I'm asking for opinions rather than facts.

 

 

In my game world, Y=up, Z=forward, and X=right. I'm in the middle of writing some matrix-rotation functions that use sin()/cos() to spin their vectors around each specific axis (such as RotateX(float angle), etc). I'm currently relying on DirectX (using D3DXQuaternionRotationAxis() on an ID-quaternion with specific hardcoded axes, then examining the result) to determine which way to spin a positive angle around each axis. This is what I've extracted from that:

 

 

Positive rotation of 90 degrees on each axis: (rotation concept for a car in parenthesis, for mental image)

X-axis: changes Z+ to Y- (car goes down hill, forward)

Y-axis: changes Z+ to X+ (car goes around a turn to the right)

Z-axis: changes X+ to Y- (car rolls, facing driver-side toward the ground)

 

 

For some reason, the X and Y axis rotations "feel right" to me, but the Z axis feels backwards. The Y rotation feels clockwise (?) while Z feels counter-clockwise (I guess the concept of clockwise is a 2D notion?). Is it just me? Is there a reason this axis rotates in that specific direction? Is this the logical way math plays out when working with quaternions, or was it a decision made by Microsoft? Judging by my own quaternion math (which is still in its infancy), I would say it just works out that way, but I can't really rely on it being accurate at the moment.

 

I'm asking this question in the Graphics forum because that's what my math library will be used for. The proper math angles don't concern me as much as what will work best when rotating 3D objects. In the end, these may both be the same, but I'm not in the place to know yet.

 

Thanks a bunch for any advice.

Edited by Stephany
0

Share this post


Link to post
Share on other sites

Another note to add is that, when writing the functions to rotate on the X and Z axes, I seem to have to negate the scaler angle sent to cos() and sin() for the rotation to match a normal axis rotation. Is this normal, or am I simply doing everything else backwards?

 

Thanks for any help!

0

Share this post


Link to post
Share on other sites

car rolls, facing driver-side toward the ground

That’s about as ambiguous as you can get.
“Which way should it rotate?”
“So the driver’s side goes to the ground before the passenger’s side.”
“Okay, so…which way should it rotate?”
The driver’s side in what country? America? England? In other words, do they drive on the right side of the road or the wrong left side of the road?  Is the car imported?

 

I am going to assume this is what you want:

An airplane rotating around positive Z will lift its left wing and lower its right wing (and if physics ensue it will veer off to the right).

 

 

This is a standard left-handed coordinate system.

 

 

Direct3D claims to default to left-handed coordinate systems, yet their functions such as D3DXMatrixRotationYawPitchRoll() are right-handed.

Likewise, D3DXQuaternionRotationAxis() rotates clockwise around each axis as if you were looking from a positive value along the axis towards the origin, which is basically a long-winded way of saying it is right-handed.  If you start at X = 1 and look towards X = 0, a clockwise rotation would be as you described—tilting the car forward.  Do the same with Y and you get the same result as you described.  With Z you get the opposite of what I described (left wing down).

This applies to D3DXMatrixRotationZ() as well.

All of the above assumes a left-handed coordinate system in which X goes away from you to the right, Y goes away from you up, and Z goes away from you forward.

IC412518.png

 

 

So you will have to make your own functions or invert the Z axis when you pass it to those types of functions.

Left-handed matrix-rotation functions are readily available online.  I have never searched but no doubt there are some for quaternions as well.

 

 

L. Spiro

Edited by L. Spiro
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