Rotateable cameras

  ... the case you feel the need for a new feature or want to submit one.

Rotateable cameras

Postby WalterSear » Thu Jul 22, 2010 11:43 pm

My initial conception for the game I'm building involved rotating the scene around the player, so that the orientation of the player and of onscreen controls remains consistent, while the world rotates around them.

Would setting rotation on cameras to allow this be unfeasible?
_,.-+=~'"`'"~=+-.,_,.-+=~'"`'"~=+-.,_
MUSIC AND SOUND DESIGN
Music, SFX and voice overs.
Clients include Id software, Microsoft and Nicolas's Farm Tower :) Moo-ooo!
PM me, let's talk.
`'"~=+-.,_,.-+=~'"`
WalterSear
 
Posts: 43
Joined: Sat Jul 17, 2010 4:46 am

Re: Rotateable cameras

Postby Nicolas Gramlich » Fri Jul 23, 2010 12:32 am

That would actually be very very easy to implement but probably introduce some problems that 0:30 am is to late to think of without missing something. (I.e. the TMXTiledMap performs the culling based on an unrotated camera).

Nevertheless I added a PostIT to my monitor, which is currently getting pretty crowded :( (Wish the defense of my thesis would be finally over...)

Best Regards,
Nicolas
Nicolas Gramlich
Site Admin
 
Posts: 1734
Joined: Mon Jun 07, 2010 6:20 pm
Location: Schriesheim, Germany

Re: Rotateable cameras

Postby Paul » Sun Jul 25, 2010 11:42 am

I was just about to create a new topic about this! It would be really useful for top-down games :)
Paul
 
Posts: 92
Joined: Sat Jun 26, 2010 3:00 pm

Re: Rotateable cameras

Postby Paul » Sun Jul 25, 2010 2:26 pm

Also, it would be great if the camera had the "focusing on object" like the chase camera, where it would rotate depending on the rotation of the sprite/object.
Paul
 
Posts: 92
Joined: Sat Jun 26, 2010 3:00 pm

Re: Rotateable cameras

Postby WalterSear » Mon Jul 26, 2010 7:59 am

Paul wrote:Also, it would be great if the camera had the "focusing on object" like the chase camera, where it would rotate depending on the rotation of the sprite/object.


Yes, it wouldn't be much use if it you couldn't push the object's rotation to the camera for use. But, I think this is already possible.
_,.-+=~'"`'"~=+-.,_,.-+=~'"`'"~=+-.,_
MUSIC AND SOUND DESIGN
Music, SFX and voice overs.
Clients include Id software, Microsoft and Nicolas's Farm Tower :) Moo-ooo!
PM me, let's talk.
`'"~=+-.,_,.-+=~'"`
WalterSear
 
Posts: 43
Joined: Sat Jul 17, 2010 4:46 am

Re: Rotateable cameras

Postby Paul » Thu Aug 05, 2010 3:02 pm

So today I tried to implement the rotateable camera, but all I was able to achieve was the rotation of the camera according to the focused object, with one line of code:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. pGL.glRotatef(rotation, 0, 0, 1);
  2.  
Parsed in 0.029 seconds, using GeSHi 1.0.8.4


but since the mMaxY,mMaxX etc. camera coordinates are unchanged, the image is skewed and stretches as the camera rotates. I was trying to fix this with the transformation equations here http://mathcentral.uregina.ca/QQ/databa ... aham1.html but with no luck.. the camera started rotating wildly. Nicolas if you could give me a hint as how to solve this I think I could do it for you :)

Thanks,
Paul
Paul
 
Posts: 92
Joined: Sat Jun 26, 2010 3:00 pm

Re: Rotateable cameras

Postby bhecox65 » Sun Aug 15, 2010 9:56 pm

Bump! Has anyone figured this out?? I really need this camera rotation as well, and I certainly think it would be helpful to many many other people. Thanks!
bhecox65
 
Posts: 31
Joined: Sun Aug 08, 2010 11:09 pm

Re: Rotateable cameras

Postby Nicolas Gramlich » Sun Aug 22, 2010 12:44 pm

Hi,

basically this shouldn't be more than doing a little change in Camera.onApplyMatrix you can see that there is "rotateHalfAround" when this.mFlipped == true, so I assume it will work with any other angle than 180°.

[Edit]Ok visually it works, but TouchEvents are not converted and culling of TMXTiledMaps is wrong.

See this line (in a temp commit I did that rotates the camera by 90°):
http://code.google.com/p/andengine/sour ... 042058#184[/Edit]

Best Regards,
Nicolas
Nicolas Gramlich
Site Admin
 
Posts: 1734
Joined: Mon Jun 07, 2010 6:20 pm
Location: Schriesheim, Germany

Re: Rotateable cameras

Postby Nicolas Gramlich » Tue Aug 24, 2010 4:44 pm

Okay I have it working internally, but the problem was that rotating the CameraScenes(HUDs/Menus) by the same amount didn't really make sense, so I'm introducing a separate rotation for such CameraScenes, where I have just one little bug left.

I hope to get it finished today. :)

Best Regards,
Nicolas
Nicolas Gramlich
Site Admin
 
Posts: 1734
Joined: Mon Jun 07, 2010 6:20 pm
Location: Schriesheim, Germany

Re: Rotateable cameras

Postby Paul » Wed Aug 25, 2010 1:24 pm

Awesome :) thanks!
Paul
 
Posts: 92
Joined: Sat Jun 26, 2010 3:00 pm

Next

Return to Features

Who is online

Users browsing this forum: Therdiday and 11 guests