Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm developing a game with large obstacle and sprites(in cocos2d+box2d for iPhone), then after zooming out my sprites and layer (by increasing cameraZ), I make my game to play by user, which causes some problem in touch detection of dynamic objects.

Can it be said a good approach to work with? If No then what will be the solution to work properly(consider that I have traveled so far with this approach)?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I'm not quite sure I understand your question entirely.

I'm guessing you're having problems because the Z of your camera changes and makes all your collision detection off.

If this is the case, you could try changing the FOV of the camera for the 'zoom' effect, this will remove any problems with the axis.

share|improve this answer
    
Well, please code, how to change the FOV. –  rptwsthi Jun 1 '11 at 9:42
    
In your call to gluPerspective(), the first parameter is the FOV, probably 45 or 60. The higher this number is, the more the camera 'zooms-in'. –  Jonathan Connell Jun 1 '11 at 9:45
    
[self.camera setEyeX:0 eyeY:0 eyeZ:180];(i'm using this line for zooming out, putting camera far from my sprites by increasing z) –  rptwsthi Jun 1 '11 at 9:48
    
Apparently you need to use the 'eye' property to scale instead of moving the camera. [self.camera setEyeX:x2 eyeY:y2 eyeZ:zoomFactor]; Where zoomFactor is your zoom factor :P –  Jonathan Connell Jun 1 '11 at 10:03
    
But i thought it is the only way to zoom out with proper touch detection(almost) –  rptwsthi Jun 1 '11 at 10:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.