Rotating an object in a group as a Camera on a larger than screen size map fixed to x & y coords

Could you please tell me if the following is possible within Corona, and please give me an indication of how to implement it, if possible:

The game is based in space. I have a ship which is centered in the middle of the viewable area, and as you are looking at it, the actual ship itself does not rotate.

There will be a larger than screen size (possibly tiled) map behind it, that will be fixed in x,y space. It in itself will not rotate.

What I would like is for the ship (and the hud elements) and the viewable area to rotate over the background map as a camera. The camera would need to rotate 360 degrees. This is so I don’t have to rotate the background (tiles and everything else) and worry about all the calculations needed to keep all the background elements in check. (In other words, I want the ship to stay in place and have the illusion that everything else is rotating around it.)

I have seen a car racing game made in Corona which uses the camera concept, but I don’t think the camera rotates, it just looks like it follows the x,y orientation of the map.

I know that I have to group the ship and HUD elements together, it’s just figuring out how to connect these to the viewable area and rotate them altogether as a ‘Camera’.

(Note: I could visibly rotate the ship itself over the map, BUT the map would not visibly rotate around the player and I do not want this.)

I have tried to word this the best I can, if you need more clarification on what I am trying to say, just ask.

Note this is my first post on the Corona forums. If this post is in the wrong area, I apologise.

Hi @s0232904,

There is a popular 3rd-party code share module available which implements a “camera” in various ways. I’m not sure it handles the rotation you speak of, but it can probably be adapted toward that purpose. Here’s the page with a link to download it:

http://developer.coronalabs.com/code/perspective

Best regards,

Brent

Hey @s0232904:

Perspective does not support camera rotation at this time (though it is something I’ve looked into before). I’m currently swamped, but I’ll put a Perspective overhaul on my list for when I get a free opening (I’ve been needing to re-write it, anyway, to add scaling support).

  • Caleb

Thank-you for your replies Brent and Caleb.

Since I haven’t found out if what I have asked for is possible at the moment I have decided to go for the workaround which is to group all my objects together and rotate the parent group. I am doing it this way because, as you already know, the child objects inherit the parents objects x & y coords even on rotation.

I hope this helps out anyone else who reads this and is wanting to do the same kind of thing.

Hi @s0232904,

There is a popular 3rd-party code share module available which implements a “camera” in various ways. I’m not sure it handles the rotation you speak of, but it can probably be adapted toward that purpose. Here’s the page with a link to download it:

http://developer.coronalabs.com/code/perspective

Best regards,

Brent

Hey @s0232904:

Perspective does not support camera rotation at this time (though it is something I’ve looked into before). I’m currently swamped, but I’ll put a Perspective overhaul on my list for when I get a free opening (I’ve been needing to re-write it, anyway, to add scaling support).

  • Caleb

Thank-you for your replies Brent and Caleb.

Since I haven’t found out if what I have asked for is possible at the moment I have decided to go for the workaround which is to group all my objects together and rotate the parent group. I am doing it this way because, as you already know, the child objects inherit the parents objects x & y coords even on rotation.

I hope this helps out anyone else who reads this and is wanting to do the same kind of thing.