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

Translation Gizmo

3 posts in this topic

In my 3D editor i have an Translation gizmo that display the direction which an object is facing. If you select the x axis for example and moved the mouse in the direction of the gizmo it follows that direction. Now the problem that i am having is that if i perform an yaw of 180 degress and the x axis ends up facing the left direction. When i select it and moved the mouse left it end up mirroring instead of moving to the left. I have found that out that my mouse coordinate which i am using as a scale factor to determines whether i moved left or right never changed. So when the x axis values end up been (-1,0,0) for example and when i move my mouse left. it takes the new mouse position and subtract from the old one, i end up with -1 for the mouse as well so when i multiply the mouse delta by the left axis it ends up flipping the axis back to positive. So what i am looking for is a way i can convert my mouse to be in the same space as my camera/object. So to sum it up, i am looking for a way for my gizmos to translate in teh direction that the arrow is pointing too no matter what the orientation of the object or the camera. If anyone can help, i would greatly appreciate it.

Thanks
0

Share this post


Link to post
Share on other sites
[quote name='BornToCode' timestamp='1348556834' post='4983488']
In my 3D editor i have an Translation gizmo that display the direction which an object is facing. If you select the x axis for example and moved the mouse in the direction of the gizmo it follows that direction. Now the problem that i am having is that if i perform an yaw of 180 degress and the x axis ends up facing the left direction. When i select it and moved the mouse left it end up mirroring instead of moving to the left. I have found that out that my mouse coordinate which i am using as a scale factor to determines whether i moved left or right never changed. So when the x axis values end up been (-1,0,0) for example and when i move my mouse left. it takes the new mouse position and subtract from the old one, i end up with -1 for the mouse as well so when i multiply the mouse delta by the left axis it ends up flipping the axis back to positive. So what i am looking for is a way i can convert my mouse to be in the same space as my camera/object. So to sum it up, i am looking for a way for my gizmos to translate in teh direction that the arrow is pointing too no matter what the orientation of the object or the camera. If anyone can help, i would greatly appreciate it.

Thanks
[/quote]

not certain if i understand you correctly, so i might be way off, but:

if the objects exist on a flat plane, then you could use glUnProject to map your mouse screen coordinates into object space(i'd probably shoot a ray from the front->back of the depth buffer, and get the point on the flat plane that the ray intersects with.) from this, you can simply point the object at the mouse using basic triginometry.

of course this is assuming that the object's rotation is working in 2D(even if it's a 3D application), if you can rotate by all axis's, then i'd probably map the mouse to whichever major axis you are attempting to rotate by.

hope this helps=-)
0

Share this post


Link to post
Share on other sites
[sub]Let me see if i can make it clearer. In tools such as Unity 3D or 3D max for example when you translate your object they always follow the translation gizmo direction. So for example the x axis of the gizmos points to the right and you select that axis and move your mouse to the right the object will move right. Now let's say we rotate that object by 180 degress around the Y Axis, now all the x axis no longer faces the right it will face the left. Now to solve that problem that is easy all i do is take whatever the current right axis and add it to my position.But the problem is i need to multiply that right axis by some form of delta so it knows to move either left or right. The delta that i am using is based of the mouse coordinate changes every frame. So if your mouse is position at for example 100,100 and you move right and the mouse becomes 101,100, then the delta for x will be =1 and y=0 . The same would happen if you move in the opposite direction and get x=-1 and y=0.I used this delta factor to mupliply my right axis with so it know wheneter to move left or right. Now the problem is this when the right axis end up been at -1,0,0 and then i move my mouse left i will get a delta of x=-1. So when i multiply this delta by the right axis it ends up flipping the x back to positive and then when i add this right axis to my position it moves the object right instead of left. What i need is a way to convert that mouse coordinate not only to the object frame of reference also the camera frame of reference as well. Because the same issue will occur as the camera changes orientation, the axis will change as well.[/sub]
0

Share this post


Link to post
Share on other sites
Forget it. I fix it. Just in case someone in the future runs into the same issue. What i did to fix it. is convert my mouse (x,y,0) to 3d camera space, then convert my object to camera space as well. Then use the delta from the mouse to camera space
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