Welcome to Dream.In.Code
Getting Help is Easy!

Join 117,543 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,783 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



changing yaw relative to roll

 
Reply to this topicStart new topic

changing yaw relative to roll

ctcrmcou
post 2 May, 2008 - 09:39 AM
Post #1


New D.I.C Head

*
Joined: 2 May, 2008
Posts: 2

Hi,

I have no problem rotating my "camera" on the 3 axes. What I cannot figure out is how to apply a yaw change to my camera relative to the current roll angle, not the vertical axis.

Basically I track the yaw, pitch, and roll values to display my objects from the camera's point of view.

If I roll the camera, say 30 degrees, and then want to change the yaw by 20 degrees, I figure the yaw and pitch would both need to be adjusted somehow, depending on both the roll angle and the current yaw angle, since I want the objects on the screen to move horizontally across the screen.

If you follow me, please offer any suggestions.

Thanks.
User is offlineProfile CardPM

Go to the top of the page


KYA
post 4 May, 2008 - 06:37 AM
Post #2


#include <nerd.h>

Group Icon
Joined: 14 Sep, 2007
Posts: 3,087



Thanked 24 times

Dream Kudos: 1150
My Contributions


Why not move the objects along the x axis instead? Then your camera can have the scrolling effect and can move with the objects as well.

The only part that confuses me is that you say you want the objects to move horizontally (x axis), but want to change the roll and yaw of the camera to do it. Rolling is not the movement of an x or y axis it is "rolling" around, which won't give the appearance of horizontal movement.
User is offlineProfile CardPM

Go to the top of the page

ctcrmcou
post 7 May, 2008 - 07:50 AM
Post #3


New D.I.C Head

*
Joined: 2 May, 2008
Posts: 2

Thanks KYA,

What I meant by the "confusing part", is that the view from the camera from the spectators perspective would result in the objects seeming to move horizontally across the screen. This is where the roll of the camera is cancelled out by the panning left or right in the yaw, where actually a yaw and pitch adjustment are both happening simultaneously.

In any case, I've got another strategy to work this out. I'll create an object that can be yawed, rolled, and pitched (which do work correctly), and use it to represent the camera to pull its top corner coordinates to find the angles.

All this trig is so nuts. I've learned so much getting the wrong results.
User is offlineProfile CardPM

Go to the top of the page

Codersys
post 21 May, 2008 - 11:33 AM
Post #4


New D.I.C Head

*
Joined: 12 May, 2008
Posts: 6

It seems to me that you might be looking at this problem from the wrong perspective. I`m not overly sure that I know what it is your trying to do, but... You keep referring to the Angles of the Object & Camera.

It sounds to me that you should be using a Matrix to hold the Orientation of your Object 4x4 (or just 3 x Vector3 values). Plus a Matrix to hold the Camera Orientation. Use Matrix rotation to change the object/camera orientations instead of trying to store the current Angles of each axis. This method will give you alot more flexibility & control.
Also the movement of your object would then just be along its Zaxis or a Normalize version of the XY components of the Z axis(if you want the object to stay on the ground only!).

Hope I made some sense.

wink2.gif

ps. If you want to rotate the Orientation Axis relative to the orientation vectors XYZ (ie Row relative to Yaw) then let me know and I will post my rather big formula for you to use.

This post has been edited by Codersys: 21 May, 2008 - 11:35 AM
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/7/08 05:56PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month