kottore / away3d

Automatically exported from code.google.com/p/away3d
0 stars 0 forks source link

[Away3Dlite] Hover camera behaves differently depending on the location of the target #78

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a view and hover camera
2. Set the hover camera tilt to 20 and pan to 0
3. Add a box or mesh to the scene
4. Move the mesh to random locations

What is the expected output? What do you see instead?

No matter where the mesh is in global space you should always be looking 
down on it. If the mesh is at 0,0,0 all works well. But, if the mesh is up 
high the hovercamera will be looking up at the bottom of the model and 
adjusting the tilt angle does not resolve the issue.

What version of the product are you using? On what operating system?

Away3DLite (Trunk)
Flex 3
Windows Vista

Please provide any additional information below.

Original issue reported on code.google.com by tonyghe...@gmail.com on 8 Nov 2009 at 3:02

GoogleCodeExporter commented 8 years ago
I found the Away3Dlite HoverCamera bug. 

In the Away3Dlite Trunk the HoverCamera3D.as has the following bug. Please 
note that the Y and Z axis are swapped. 

130 var gx:Number = target.x + distance*Math.sin 
(_currentPanAngle*toRADIANS)*Math.cos(_currentTiltAngle*toRADIANS); 
131 var gz:Number = target.y + distance*Math.cos 
(_currentPanAngle*toRADIANS)*Math.cos(_currentTiltAngle*toRADIANS); 
132 var gy:Number = target.z - distance*Math.sin 
(_currentTiltAngle*toRADIANS)*yfactor; 

they should be 

130 var gx:Number = target.x + distance*Math.sin 
(_currentPanAngle*toRADIANS)*Math.cos(_currentTiltAngle*toRADIANS); 
131 var gz:Number = target.z + distance*Math.cos 
(_currentPanAngle*toRADIANS)*Math.cos(_currentTiltAngle*toRADIANS); 
132 var gy:Number = target.y - distance*Math.sin 
(_currentTiltAngle*toRADIANS)*yfactor; 

Now the HoverCamera is working perfectly after this fix. 

Original comment by tonyghe...@gmail.com on 18 Nov 2009 at 6:04

GoogleCodeExporter commented 8 years ago
Hi, I also encountered the same issue during my developing.
When I used some thing like

switch(lastKey){
case Keyboard.UP:
    camera.target.z -= 100;
    break;
case Keyboard.DOWN:
    camera.target.z += 100;
    break;
case Keyboard.LEFT:
    camera.target.x += 100;
    break;
case Keyboard.RIGHT:
    camera.target.x -= 100;
    break;
}
camera.hover();

The camera behavior was strange, when I press UP or DOWN.
And I found the same fix. It works perfectly. I guess it is an bug introduced 
by 
typo.

Thanks!
Charlie Ping

Original comment by interest...@gmail.com on 13 Mar 2010 at 5:45

GoogleCodeExporter commented 8 years ago
This is fixed in the latest trunk revision

Original comment by rob.bate...@gmail.com on 4 Jul 2010 at 5:57

GoogleCodeExporter commented 8 years ago
Rob thank you! It has been a pain to fix this with every update after check out 
since Nov of 2009.

Original comment by tonyghe...@gmail.com on 13 Jul 2010 at 2:35