[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] my 3d planet game



He's missing a major detail, namely that you're going to need to
translate to/from spherical co-ordinates if you want to do it right.
You could just toy around with the look speed until you found something
close to right, but you might as well just get it right to start with.

Whenever you call gluPerspective, store the fovy and aspect parameters.
  Multiply fovy by aspect to get fovx.  Divide each of these by the
respective screen dimension to get unitx and unity, the arc size (in
degrees) represented by each pixel in the x and y directions, respectively.

From there, you just use whatever code you already have for handling
drags and multiply the mouse motion by unitx and unity to get the amount
you need to turn the view by.

I may have missed a few details, but that's the basic method.

-FM

Astan Chee wrote:
> James Paige wrote:
>> On Fri, Jun 13, 2008 at 07:21:30PM +1000, Astan Chee wrote:
>>  
>>>> * When dragging with RMB, the mechanics feel off.  The mouse cursor
>>>> should stay on top of roughly the same bit of space as I drag it, not
>>>> have the space go zooming out past it.
>>>>  
>>>>       
>>> I dont know how to do this in pygame. Is there an example somewhere
>>> of how to do this?
>>>     
>>
>> WHen you recieve the right mouse button's mouse down event, store the
>> X/Y position of the mouse. Then, until you recieve the mouse up event,
>> position the camera according to the difference between the current
>> position of the mouse and the position when the right button was first
>> pressed.
>>   
> Somehow I still dont understand this.Can you paraphrase this in
> pseudocode or some snippet?
> Thanks
>> ---
>> James Paige
>>
>>   
> 



Attachment: signature.asc
Description: OpenPGP digital signature