|
Dan
|
 |
« on: February 19, 2006, 09:35:56 AM » |
|
The joys of math have got me again. What I need is a function I can call which orbits the camera aroung a point. The parameters to this function state the viewport if (from which a camera is obtained) and the Incremetnal angles to which the changes should be applied. This I have been able to achieve by recording the angles for each viewport and calling the movearounpoint to calculate a position. However, This method has serious limititations and relies on accurate record keeping of the angles. I want to backout the Horizontal and vertical angles from the camera position and lookat. I modified the code to calculate the horizontal and Verticle angles based upon the inverse of the camera direction and then adding to this the incremental angles to obtain the values to plugin to the movearoundpoint function. There is a problem with this method that I can't easily seem to track down. the angles returned by direction2Ang seem to be out (It appears by 90Degrees). (As posted before by KenWhiteHead TVMath 2D funtions: RotateAroundPoint2D and Direction2Ang) Has anyone done this before and able to give any pointers to what I am doing wrong? VB.NET code: Public Sub OrbitCamera(ByVal iViewportID As Integer, ByVal X As Integer, ByVal Y As Integer) If X <> 0 Or Y <> 0 Then 'Only do this when we have changes to apply Dim Cam As MTV3D65.TVCamera = Viewport(iViewportID).GetCamera Dim CamPos As New TV_3DVECTOR(Cam.GetPosition.x, Cam.GetPosition.y, Cam.GetPosition.z) 'Use 0,0,0 as lookat for now Dim CamLookat As New TV_3DVECTOR(0, 0, 0)
'Obtain the radius of the orbit (Distance from Camera position to camera lookat point) Dim OrbitRadius As Single = Math.GetDistance3D(CamPos.x, CamPos.y, CamPos.z, CamLookat.x, CamLookat.y, CamLookat.z)
'Calculate the existing angles to plugin in to the movearoundpoint function Dim InvCamDirection As TV_3DVECTOR Math.TVVec3Subtract(InvCamDirection, New TV_3DVECTOR(CamLookat.x, CamLookat.y, CamLookat.z), Cam.GetDirection) AngleX = Math.Direction2Ang(InvCamDirection.x, InvCamDirection.z) AngleY = Math.Direction2Ang(InvCamDirection.x, InvCamDirection.y)
'Add the angle changes to the current angles Dim OrbitX As Single = AngleX + X Dim OrbitY As Single = AngleY + Y
'Get the new position of the camera Dim CamPos_Result As TV_3DVECTOR = Math.MoveAroundPoint(New TV_3DVECTOR(CamLookat.x, CamLookat.y, CamLookat.z), OrbitRadius, OrbitX, OrbitY)
'Set the cameras position to the calculated results Cam.SetPosition(CamPos_Result.x, CamPos_Result.y, CamPos_Result.z) Cam.SetLookAt(CamLookat.x, CamLookat.y, CamLookat.z)
'Return the camera object to the viewport Viewport(iViewportID).SetCamera(Cam) End If End Sub
Below is a video that shows the results of a negative X value. The viewport camera flipflops on every alternate frame (+/- 45) which make me think I should be obtaining a perpendicular. (1.3 Mb Self Extracting Video file)
|
|
|
|
|
Logged
|
|
|
|
|
pizzayoyo
|
 |
« Reply #1 on: February 19, 2006, 10:17:05 AM » |
|
I'm a little confused as to what you are trying to do, but i was trying to do sorta the same thing last night, so i might be able to help. Here's what i did... You basically have to keep track of the angles and update them based on the time elapsed and what direction the user is dragging. After setting the cam position, then set the LookAt to the coordinates of the point. Code: (CamPos is the point, 100 is the radius, CamPos2 is the new point) CamPos2 = Math.MoveAroundPoint(CamPos, 100, lRotateAngleHoriz, lRotateValueVert) Scene.GetCamera.SetPosition(CamPos2.x, CamPos2.y, CamPos2.z)
Scene.GetCamera.SetLookAt(CamPos.x, CamPos.y, CamPos.z)
|
|
|
|
|
Logged
|
|
|
|
|
Dan
|
 |
« Reply #2 on: February 19, 2006, 10:41:57 AM » |
|
Hi Pizzayoyo, I am wanting to implement a camera orbit feature. the problem with keeping track of the angles (Horizontal and Verticle) comes after the camera has been rotated and therefore a new lookat point is created. If you use the previous angles the camera will jump. I need to be able to calculate the existing Horizontal and Vertical angles so I can increment by the passed in X,Y relative values. the section of the code from above that I believe is causing problems is the chunk below. 'Calculate the existing angles to plugin in to the movearoundpoint function Dim InvCamDirection As TV_3DVECTOR Math.TVVec3Subtract(InvCamDirection, New TV_3DVECTOR(CamLookat.x, CamLookat.y, CamLookat.z), Cam.GetDirection) AngleX = Math.Direction2Ang(InvCamDirection.x, InvCamDirection.z) AngleY = Math.Direction2Ang(InvCamDirection.x, InvCamDirection.y)
|
|
|
|
|
Logged
|
|
|
|
|
Brac
|
 |
« Reply #3 on: February 19, 2006, 11:14:13 AM » |
|
Why don't you just store the angles in a private variable? If you want to have a function that takes 2 relative angles as parameters, simply add those angles to your private absolute angles and you're done. No need to extract the angles from the camera position (which is a pain anyways). private float angle_h; private float angle_v;
void orbit(TV_3DVECTOR center, float distance, float angleH, float angleV) { angle_h += angleH; angle_v += angleV;
TV_3DVECTOR new_pos = TVMathLibrary.MoveAroundPoint(center, distance, angle_h, angle_v) camera.SetPosition(new_pos.x, new_pos.y, new_pos.z); camera.SetLookAt(center.x, center.y, center.z); }
|
|
|
|
|
Logged
|
|
|
|
|
Dan
|
 |
« Reply #4 on: February 19, 2006, 01:09:26 PM » |
|
Why don't you just store the angles in a private variable? ... This I have been able to achieve by recording the angles for each viewport and calling the movearounpoint to calculate a position. However, This method has serious limititations and relies on accurate record keeping of the angles. I want to backout the Horizontal and vertical angles from the camera position and lookat.
...
the problem with keeping track of the angles (Horizontal and Verticle) comes after the camera has been rotated and therefore a new lookat point is created. If you use the previous angles the camera will jump.
I know how to get it to work by storing the values. But I've already stated this causes issues if you rotate the camera to look at a new point, which is why I need to back the existing angles out of the cameras position. I know what needs to be done its the implementation I'm having issues with 
|
|
|
|
|
Logged
|
|
|
|
jviper
Community Member

Posts: 2127
Discipline in training
|
 |
« Reply #5 on: February 19, 2006, 04:30:04 PM » |
|
I see what your saying. There are times when you will need to take a direction vector and get angles from it. Here's a hint: You must convert Carteasion coordinates to Spherical Coordinates. In thoery, it is perfectly possible. Manually, it will involve some inverse trig functions. Here's some conversion functions that came straight out of my Calculus Book in the Surfaces Chapter: Given: p,ax,ay in Spherical Coordinates, where p is the distance from an origin, ax is the horizontal angle, and ay is the vertical angle x = p sin(ay) cos(ax) y = p cos(ay) z = p sin(ay) sin(ax) Given x,y,z in Carteasian Coordinates, where the point (x,y,z) is a point relative to a point of origin p = sqrt(x^2 + y^2 + z^2) ax = arctan( x/y ) ay = arccos( z/p ) Now, I'm not sure of the arguments of the tvMath.Direction2Ang. I'll have to take a look, to see if you've plugged in the correct values into that function. It may turn out that that function could be bugged. I actually didn't even know that function exsisted. Oh, and also, I think the Camera.GetLookAt returns a normalized vector, meaning it's components reange from 0 to 1. If this is true then all you have to do is invert the vecter, and you can find your angles from there.
|
|
|
|
|
Logged
|
JAbstract.....Don't just imagine, make it happen!
|
|
|
|
Dan
|
 |
« Reply #6 on: February 19, 2006, 05:28:10 PM » |
|
Thanks JViper that second formula looks like it's the one for me. I'll be giving it a go tomorrow so will post an update then...
|
|
|
|
|
Logged
|
|
|
|
|
Dan
|
 |
« Reply #7 on: February 20, 2006, 05:45:26 PM » |
|
I feel some progress has been made and I've found lots of useful information about the various coord systems. However, something odd is happening. At first it appers to work but when trying in a different viewport the camera jumps which indicates to me that the code to extract the spherical coords is wrong. The evening for me is coming to a close so I thought I'd leave this code snip here just in case some one is able to tell me what an idiot I've been  ... Public Sub OrbitCamera(ByVal iViewportID As Integer, ByVal X As Integer, ByVal Y As Integer) If X <> 0 Or Y <> 0 Then 'Only do this when we have changes to apply Dim Cam As MTV3D65.TVCamera = Viewport(iViewportID).GetCamera
Dim CamPos As New TV_3DVECTOR(Cam.GetPosition.x, Cam.GetPosition.y, Cam.GetPosition.z) Dim CamLookat As New TV_3DVECTOR(0, 0, 0) Dim CamRelPos As TV_3DVECTOR
'Calculate the cameras relative position (Campos - CamLookat) Math.TVVec3Subtract(CamRelPos, CamLookat, CamPos)
'Obtain the radius of the orbit (Distance from Camera position to camera lookat point) Dim OrbitRadius As Single = System.Math.Sqrt(CamPos.x ^ 2 + CamPos.y ^ 2 + CamPos.z ^ 2)
'Calculate the current angles using Cartesian to Spherical coords formula and add incremental values Dim OrbitX As Single = Math.Deg2Rad(Math.ATan(CamPos.y / CamPos.x) + X) Dim OrbitY As Single = Math.Deg2Rad(Math.ACos(CamPos.z / OrbitRadius) + Y)
'Get the new position of the camera Dim CamPos_Result As TV_3DVECTOR
'Convert the Spherical coords to Cartesian CamPos_Result.x = OrbitRadius * System.Math.Sin(OrbitY) * System.Math.Cos(OrbitX) CamPos_Result.y = OrbitRadius * System.Math.Sin(OrbitY) * System.Math.Sin(OrbitX) CamPos_Result.z = OrbitRadius * System.Math.Cos(OrbitY)
'Set the cameras position to the calculated results Cam.SetPosition(CamPos_Result.x, CamPos_Result.y, CamPos_Result.z) Cam.SetLookAt(CamLookat.x, CamLookat.y, CamLookat.z)
'Return the camera object to the viewport Viewport(iViewportID).SetCamera(Cam) End If End Sub
|
|
|
|
|
Logged
|
|
|
|
jviper
Community Member

Posts: 2127
Discipline in training
|
 |
« Reply #8 on: February 20, 2006, 08:43:35 PM » |
|
Do you mean it jumps when you change targets, or if jumps while your rotating around a target?
Oh, also possible that the ATan and ACos returns angles in radians. And I think you'll have to switch the y and z components on the sphere to carteasion conversion.
|
|
|
|
|
Logged
|
JAbstract.....Don't just imagine, make it happen!
|
|
|
|
Dan
|
 |
« Reply #9 on: February 21, 2006, 05:37:50 AM » |
|
Thanks for taking the time to look JViper. I think you are right about the cartesian to spherical function returning in Rads. I will convert the x,y values being passed in to rads prior to adding to the calculated angles. 'Calculate the current angles using Cartesian to Spherical coords formula and add incremental values Dim OrbitX As Single = Math.ATan(CamPos.y / CamPos.x) + Math.Deg2Rad(X) Dim OrbitY As Single = Math.ACos(CamPos.z / OrbitRadius) +Math.Deg2Rad(Y)
As for the swapping the Z and Y components. Well spotted, I did have it the way you had mentioned in your post but swapping caused a smoother result (But still eratic) and was prompted by this post on the Garage Games site. but it does hint that Z is up which I know is not the case with TV. I will revert to the methodyou proposed. I will try with the changes mentioned this evening. It's maddening how such a trivial routine can take so long. Oh well, It's all good learning...
|
|
|
|
|
Logged
|
|
|
|
Rynus_Rein
Community Member

Posts: 1008
|
 |
« Reply #10 on: February 21, 2006, 08:51:34 AM » |
|
I wrote such function a few days ago: Do While run tv.Clear()
'get mouse thingies input.GetAbsMouseState(vMouseNew.x, vMouseNew.y) input.EnableEvents(True)
'calculate difference (mouse movement) vMouseDiff.x = vMouseNew.x - vMouseOld.x vMouseDiff.y = vMouseNew.y - vMouseOld.y
'update old coords vMouseOld.x = vMouseNew.x vMouseOld.y = vMouseNew.y
'set mosue position for unlimited mouse scrollings input.SetMousePosition(v2HalfScreen.x, v2HalfScreen.y) vMouseOld.x = v2HalfScreen.x vMouseOld.y = v2HalfScreen.y
'render our teapot mesh.Render()
' by mouse: rotateX = rotateX + vMouseDiff.x / 300 rotateY = rotateY + vMouseDiff.y / 300
'calculate new values for x, y, z x = Math.Cos(rotateX) * Math.Cos(rotateY) * rx y = Math.Sin(rotateY) * ry z = Math.Cos(rotateY) * Math.Sin(rotateX) * rz
'set camera scene.GetCamera.SetPosition(x, y, z) scene.GetCamera.SetLookAt(0, 0, 0)
'draw some info scene.DrawText("[Rotating Teapot] by Rynus Rein!" & Chr(13) & Chr(10) & "Press ESCAPE to exit." & Chr(13) & Chr(10) & "Website: http://www.rynusrein.net/", 10, 10)
tv.RenderToScreen()
'check input If input.IsKeyPressed(TrueVision3D.CONST_TV_KEY.TV_KEY_ESCAPE) Then run = False
Application.DoEvents() Loop
important lines are these: x = Math.Cos(rotateX) * Math.Cos(rotateY) * rx y = Math.Sin(rotateY) * ry z = Math.Cos(rotateY) * Math.Sin(rotateX) * rz
r? = radius on that angle. You can just take the same incremental values for rotateX and rotateY.
|
|
|
|
|
Logged
|
Rynus Rein Current Project: MapX Live, Society3D
|
|
|
|
Dan
|
 |
« Reply #11 on: February 21, 2006, 09:25:34 AM » |
|
Thanks Rynus, I notice your recording the angles from frame to frame. This is somthing I am trying to avoid but your right to suggest the alternate calculations... I've now got a selection to try 
x = p sin(ay) cos(ax) y = p cos(ay) z = p sin(ay) sin(ax)
OR
x = Math.Cos(rotateX) * Math.Cos(rotateY) * rx y = Math.Sin(rotateY) * ry z = Math.Cos(rotateY) * Math.Sin(rotateX) * rz
Place your bets now... :lol:  Equations for converting between cartesian and spherical coordinates 
|
|
|
|
|
Logged
|
|
|
|
|
Dan
|
 |
« Reply #12 on: February 21, 2006, 06:21:33 PM » |
|
I'm half way to solving this riddle. I've built a little test app that consistently returns correct conversions between Spherical, Cartesan and vice versa. 60K Rar file containing Visual Studio 2005 prokect files Public Structure Polar_Coords Dim R As Single Dim aX As Single Dim aY As Single End Structure
Public Structure Cartesian_Coords Dim X As Single Dim Y As Single Dim Z As Single End Structure
Function ConvertToPolar(ByVal Input As Cartesian_Coords) As Polar_Coords Dim temp As Polar_Coords temp.R = Math.Sqrt(Input.X ^ 2 + Input.Y ^ 2 + Input.Z ^ 2) temp.aX = Math.Atan2(Input.Y, Input.X) temp.aY = Math.Acos(Input.Z / temp.R) Return temp End Function
Function ConvertToCartesian(ByVal Input As Polar_Coords) As Cartesian_Coords Dim temp As Cartesian_Coords temp.X = Math.Sin(Input.aY) * Math.Cos(Input.aX) * Input.R temp.Y = Math.Sin(Input.aY) * Math.Sin(Input.aX) * Input.R temp.Z = Math.Cos(Input.aY) * Input.R Return temp End Function
EDIT: Added the formulas above to the code and it runs alot more smoothly. It still doesn't orbit how I would expect If I were recording the angles but there is no camera jumping. I have to move on to other things but hope to remedy this issue in the future. I will experiment with using the movearoundpoint function again... Public Sub OrbitCamera(ByVal iViewportID As Integer, ByVal X As Integer, ByVal Y As Integer) If X <> 0 Or Y <> 0 Then 'Only do this when we have changes to apply Dim Cam As MTV3D65.TVCamera = Viewport(iViewportID).GetCamera
Dim CamPos As New TV_3DVECTOR(Cam.GetPosition.x, Cam.GetPosition.y, Cam.GetPosition.z) Dim CamLookat As New TV_3DVECTOR(0, 0, 0) Dim CamRelPos As TV_3DVECTOR
'Calculate the cameras relative position (Campos - CamLookat) Math.TVVec3Subtract(CamRelPos, CamPos, CamLookat)
'Obtain the radius of the orbit (Distance from Camera position to camera lookat point) Dim OrbitRadius As Single = System.Math.Sqrt(CamPos.x ^ 2 + CamPos.y ^ 2 + CamPos.z ^ 2)
'Calculate the current angles using Cartesian to Spherical coords formula and add incremental values Dim OrbitX As Single = (System.Math.Atan2(CamRelPos.y, CamRelPos.x)) + (Y / 200) Dim OrbitY As Single = (System.Math.Acos(CamRelPos.z / OrbitRadius)) + (X / 200)
'Get the new position of the camera Dim CamPos_Result As TV_3DVECTOR
'Convert the Spherical coords to Cartesian CamPos_Result.x = OrbitRadius * (System.Math.Sin(OrbitY) * System.Math.Cos(OrbitX)) CamPos_Result.y = OrbitRadius * (System.Math.Sin(OrbitY) * System.Math.Sin(OrbitX)) CamPos_Result.z = OrbitRadius * System.Math.Cos(OrbitY)
'Set the cameras position to the calculated results Cam.SetPosition(CamPos_Result.x, CamPos_Result.y, CamPos_Result.z) Cam.SetLookAt(CamLookat.x, CamLookat.y, CamLookat.z)
'Return the camera object to the viewport Viewport(iViewportID).SetCamera(Cam) End If End Sub
|
|
|
|
|
Logged
|
|
|
|
Rynus_Rein
Community Member

Posts: 1008
|
 |
« Reply #13 on: February 22, 2006, 07:46:55 AM » |
|
you mean I should record the mouse angles each X frame?
|
|
|
|
|
Logged
|
Rynus Rein Current Project: MapX Live, Society3D
|
|
|
|
Brac
|
 |
« Reply #14 on: February 22, 2006, 07:50:15 AM » |
|
hm, i don't want to sound stupid, but what exactly is the goal now? i still don't get it...
To be precise (cuze I'd really like to help out): How is the camera ment to behave? Does is orbit around a fixed point? Does it look at that point or another? Does the lookat point change while the orbit center is fixed?
I still think there's a simpler solution to be discovered...
|
|
|
|
|
Logged
|
|
|
|
|
Dan
|
 |
« Reply #15 on: February 22, 2006, 09:45:26 AM » |
|
@Rynus_Rein, From looking at the code snip you gave you are recording the angle from frame to frame and adding in any mouse input to effect the orbit. rotateX = rotateX + vMouseDiff.x / 300 rotateY = rotateY + vMouseDiff.y / 300
I simply want to replace that by calculating the Spherical coords from the cartesean camera position (Relative to the lookat). The rest of the code is then very similar to the way you have it. I will try and describe why I want to do this by first explaining the problem I get when recording the angles. * = Look at point # = 2nd object < = Camera 1) the camera is looking at the look at point. It's orbit angle is 0
* <
#
2) The camera has been orbited by 90deg. orbt angle is 90
*
^
#
3) The look at target is changed to the 2nd object. the orbit angle of the camera to the 2nd look at is 270. But the recorded angle is still 90.
*
\/
#
4) The camera is orbited by a further 90 degrees around the 2nd target. the camera should be positioned at < (270 + 90 = 0) but instead is found at ? (90 + 90 = 180)
*
? # <
Calculating the angles from the camera position will avoid this 'Jumping Camera' problem from arising. @Brac, Thank you for wanting to help  I am pretty sure I have the formulas for converting between polar and cartesean coords coorectly. I have cross referenced from a number of sources and get results tha tally with 3D plotting tool I downloaded http://www.canadiancontent.net/tech/download/Calc_3D_Pro.htmlThe problem I noticed is hard to describe. Taking the Vertical angle X as an example when this value is adjusted via mouse left right input I would expect the camera to orbit around the equator. Instead it orbits the northern hemispehere and in addition appears to have a Y component angle change even when the Y component changes are filtered out. Like I say it is hard to describe. I will take another look through my code this evening and possibly post another video that shows what is happening. Thanks all for taking the time to read through this...
|
|
|
|
|
Logged
|
|
|
|
|
Brac
|
 |
« Reply #16 on: February 22, 2006, 10:57:11 AM » |
|
First i gotta say i HATE this problem and had enough problems with it. This is my suggestion, i know that it works and i'll gladly help to implement it. private tv3dvector _lookat; void orbit(float v, float h, float distance) { - set camera.lookat to _lookat - set camera.position to _lookat if(v!=0 || h!=0){ - create 2 matrices based on ur relative angles v and h - Yaw and Pitch - multiply them. - multiply the result with camera.getmatrix() - apply the result to the camera with setmatrix(). } - move the camera backwards by distance using MoveRelative. }
void change_lookat(tv3dvector new_lookat) { float d = distance3d(camera.position, new_lookat); _lookat = new_lookat; orbit(0,0,d); }
1. the cam orbits the center, just like MoveAroundPoint 2. if you change the look-at-point the camera will keep its position and look at the new point. Aint it?
|
|
|
|
|
Logged
|
|
|
|
|
Dan
|
 |
« Reply #17 on: February 23, 2006, 06:55:48 PM » |
|
Sorted! Thanks to all who contributed. Much appreciated : ) Was very close with the code yesterday. All I had to do was swap the Z and Y Axis to get the orbit effect I was after.. I have placed The code below for the benefit of others. It should be easily portable. Just modify the Camera Get at the begining and the Set and the end to suite your needs. I have tried to explain the advantages of calculating the angles from the camera position in prior posts.
Public Sub OrbitCamera(ByVal iViewportID As Integer, ByVal X As Integer, ByVal Y As Integer) If X <> 0 Or Y <> 0 Then 'Only do this when we have changes to apply Dim Cam As MTV3D65.TVCamera = Viewport(iViewportID).GetCamera
Dim CamPos As New TV_3DVECTOR(Cam.GetPosition.x, Cam.GetPosition.y, Cam.GetPosition.z) Dim CamLookat As New TV_3DVECTOR(0, 0, 0) Dim CamRelPos As TV_3DVECTOR
'Calculate the cameras relative position (Campos - CamLookat) Math.TVVec3Subtract(CamRelPos, CamPos, CamLookat)
'Obtain the radius of the orbit (Distance from Camera position to camera lookat point) Dim OrbitRadius As Single = System.Math.Sqrt(CamPos.x ^ 2 + CamPos.y ^ 2 + CamPos.z ^ 2)
'Calculate the current angles using Cartesian to Spherical coords formula and add incremental values Dim OrbitX As Single = (System.Math.Atan2(CamRelPos.z, CamRelPos.x)) + (X / 57) Dim OrbitY As Single = (System.Math.Acos(CamRelPos.y / OrbitRadius)) + (Y / 57)
'Get the new position of the camera Dim CamPos_Result As TV_3DVECTOR
'Convert the Spherical coords to Cartesian CamPos_Result.x = OrbitRadius * (System.Math.Sin(OrbitY) * System.Math.Cos(OrbitX)) CamPos_Result.y = OrbitRadius * System.Math.Cos(OrbitY) CamPos_Result.z = OrbitRadius * (System.Math.Sin(OrbitY) * System.Math.Sin(OrbitX))
'Set the cameras position to the calculated results Cam.SetPosition(CamPos_Result.x, CamPos_Result.y, CamPos_Result.z) Cam.SetLookAt(CamLookat.x, CamLookat.y, CamLookat.z)
'Return the camera object to the viewport Viewport(iViewportID).SetCamera(Cam) End If End Sub
NOTE: The Sin,Cos and Atan2 functions are all from the System.Math .NET namespace instead of using TV Math. TV Math was doing odd things between Rad & Degs.
|
|
|
|
|
Logged
|
|
|
|
Rynus_Rein
Community Member

Posts: 1008
|
 |
« Reply #18 on: February 24, 2006, 02:29:08 AM » |
|
maybe you could post it on the wiki somewhere 
|
|
|
|
|
Logged
|
Rynus Rein Current Project: MapX Live, Society3D
|
|
|
scottwinch
Community Member

Posts: 2
|
 |
« Reply #19 on: March 23, 2006, 02:47:51 AM » |
|
Dan, great coding. I have been attempting to implement it and have run into one very annoying problem. (as you can see by the time on my post it has kept me up). As the camera moves past the vertical point (directly above the look at point) the camera would have to be upside down to go any further so it flips itself over. At this point the image flips and the the (Y) movement of the mouse is reversed.
I have found a way to stop the camera from hitting the vertical plane (not allowing the angels to exceed certain values), but the camera stops there.
Most 3d viewers rotate the object about a fixed point to avoid this...*sigh* but i will have many objects, so rotating the camera is the only option.
Any more words of wisdom? thanks
|
|
|
|
|
Logged
|
|
|
|
|