Advertisement

Direct3d help please

Started by January 01, 2003 04:58 PM
4 comments, last by Smeg_Head 21 years, 10 months ago
Thanks for looking in I am playing around at doing a tacky space sim program. For a start I''ve placed the model of a cockpit just in front of the view so it appears your looking through it. Works fine. Now I''ve tried adding pitch to the ship and my problems began. I can rotate the view no problem, but the cockpit is rotating around its own axis, not the viewpoint. I am sure there must be an easy way to get the model to rotate around the view, but I''m lost. Any ideas? Thanks in advance. Gary
I have no experience in 3d stuff, but maybe you can instead of rotation the viewpoint or the cockpit rotate the WORLD the cockpit is in.


Nothing and all, by some meaning, no difference

[edited by - Optimus on January 2, 2003 11:47:13 AM]
Nothing and all, by some meaning, no difference
Advertisement
Smeg_Head, are you familiar with 3D transformations (translation, rotation, scaling) and matrices and matrix concatenation?
Yep

Ive created the matrix to rotate around the x axis. But this seems to rotate it around its own origin. Do you think it would be worth going back to basics and creating the matrix by hand rather than using the built in D3DX functions?

Thanks

P.S. Still reading back up on some 3d topics, its been a while!
"Do you think it would be worth going back to basics and creating the matrix by hand rather than using the built in D3DX functions?"

no, i wasn''t suggesting that. i was just wondering if maybe you didn''t understand concatenation and the fact that m1 * m2 != m2 * m1, which could be the cause of your rotation problem.

upon re-reading your post it sounds as if you want to rotate your cockpit while keeping your viewpoint stationary? but it sounds as if you''re doing the opposite: rotating your viewpoint while attempting to keep the cockpit stationary?

if you want the former then you just need to set the world matrix to your rotation matrix prior to rendering of your cockpit.

you can also do this by rotating the viewpoint but the rotations are not about the world''s coordinate system axes but are about the camera''s coordinate system axes instead. for that i think you would have to use something like the D3DXMatrixRotationAxis function.

sorry if this is confusing. i''m just a bit unclear as to what you actually are attempting to do.
Thanks for the help all, but I found the problem. I''d made a mistake with the view rotation not the cockpit rotation. Doh!

All fixed.

Again thanks

This topic is closed to new replies.

Advertisement