Delgine 3D Tools & Content DeleD Community Edition
Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Patch for turn-table rotation 3d view
Goto page Previous  1, 2
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    DeleD Community Edition Forum Index -> DeleD Development
View previous topic :: View next topic  
Author Message
fik
Member


Joined: 11 Oct 2006
Posts: 303

PostPosted: Thu Jan 21, 2010 10:39 pm    Post subject: Reply with quote

This is a nice welcome update Smile
Back to top
View user's profile Send private message
paul_nicholls
DeleD PRO user


Joined: 05 Dec 2007
Posts: 356
Location: Hobart, Tasmania, Australia

PostPosted: Thu Jan 21, 2010 10:40 pm    Post subject: Reply with quote

chronozphere wrote:
It works great paul! Thanks you for this. Very Happy

You could improve the feature by letting the user go "all around" the model instead of moving in a fixed circle. You could utilize the Y-coordinate of the mouse to achieve vertical movement (this would be a rotation about the X-axis in screen space). I did exactly the same for the first versions of my UV-plugin (now It has a free camera). Smile

About the docs. I'm one of the programmers who is willing to write his own documentation (It will be simple and to the point, so I can concentrate on code). Smile


Glad I could improve your 'user experience' LOL

I already had tried putting in vertical mouse movement on top of the horizontal one, but it rotated the view all strange (something to do with x-axis+ y-axis rotations or something), so I have commented out those bits till I work out something else better Sad

My x-axis rotation wasn't in screenspace, but in world space I think which was the problem...

If I could figure out how to rotate around the camera x-axis instead, perhaps I could fix it.

cheers,
Paul
_________________
Long live DeleD!

Hi ho...hi ho...it's off 3d modeling I go...
Back to top
View user's profile Send private message
chronozphere
DeleD PRO user


Joined: 20 Jun 2006
Posts: 1010
Location: Netherlands

PostPosted: Thu Jan 21, 2010 11:08 pm    Post subject: Reply with quote

The key to good camera-about-center behaviour is "spherical coordinates".
Just take a look over here:

http://en.wikipedia.org/wiki/Spherical_coordinate_system

I must map the change in X/Y of the mouse to a change in Theta/Phi (where Theta is the horizontal rotation which you have now, and Phi is the vertical rotation which is constrained to the -90..90 range).

Just combine some trigoniometry to compute the camera position from these values:

Code:

  //Compute Camera position from center
  fCamera_Pos.x :=  cos(fCamera_theta)*sin(fCamera_phi)*Distance;
  fCamera_Pos.y :=                     cos(fCamera_phi)*Distance;
  fCamera_Pos.z :=  sin(fCamera_theta)*sin(fCamera_phi)*Distance;


You will probably need to modify this code a bit. You also need to figure out how to compute the camera lookat vector.

Hope this helps. Smile
Back to top
View user's profile Send private message
paul_nicholls
DeleD PRO user


Joined: 05 Dec 2007
Posts: 356
Location: Hobart, Tasmania, Australia

PostPosted: Thu Jan 21, 2010 11:29 pm    Post subject: Reply with quote

chronozphere wrote:
The key to good camera-about-center behaviour is "spherical coordinates".
Just take a look over here:

http://en.wikipedia.org/wiki/Spherical_coordinate_system

I must map the change in X/Y of the mouse to a change in Theta/Phi (where Theta is the horizontal rotation which you have now, and Phi is the vertical rotation which is constrained to the -90..90 range).

Just combine some trigoniometry to compute the camera position from these values:

Code:

  //Compute Camera position from center
  fCamera_Pos.x :=  cos(fCamera_theta)*sin(fCamera_phi)*Distance;
  fCamera_Pos.y :=                     cos(fCamera_phi)*Distance;
  fCamera_Pos.z :=  sin(fCamera_theta)*sin(fCamera_phi)*Distance;


You will probably need to modify this code a bit. You also need to figure out how to compute the camera lookat vector.

Hope this helps. Smile


Thanks for the info chief Smile

cheers,
Paul
_________________
Long live DeleD!

Hi ho...hi ho...it's off 3d modeling I go...
Back to top
View user's profile Send private message
Paul-Jan
Site Admin


Joined: 08 Aug 2004
Posts: 3066
Location: Lage Zwaluwe

PostPosted: Fri Jan 22, 2010 3:01 pm    Post subject: Reply with quote

As a bit of nitpicking, could you try to remove all hints (and warnings of course) from the code before checking it in?

You don't have to worry about it too much, but be warned that I'll gripe and whine about sloppiness every time someone does this. Very Happy
Back to top
View user's profile Send private message Visit poster's website
paul_nicholls
DeleD PRO user


Joined: 05 Dec 2007
Posts: 356
Location: Hobart, Tasmania, Australia

PostPosted: Fri Jan 22, 2010 8:58 pm    Post subject: Reply with quote

Paul-Jan wrote:
As a bit of nitpicking, could you try to remove all hints (and warnings of course) from the code before checking it in?

You don't have to worry about it too much, but be warned that I'll gripe and whine about sloppiness every time someone does this. Very Happy


No problem PJ, and sorry about that Smile

I will fix it shortly!

EDIT: Oh, it was already fixed...ok Smile

cheers,
Paul
_________________
Long live DeleD!

Hi ho...hi ho...it's off 3d modeling I go...
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    DeleD Community Edition Forum Index -> DeleD Development All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum