|
Hi, Currently, I have a camera set to follow the hero in a 2d game. The current camera focuses on the hero and stays in the center of the screen, but I would like the camera to follow the hero but stay at the bottom of the screen. How would I do that? I have a very simple camera script. Here is a snippet: How do I accomplish my goal? Other than the above script, the camera values are the default settings. Thank you for your assistance.
(comments are locked)
|
|
If I'm understanding your question and comments correctly, then it seems all you need to do is set the Y position of the camera to some positive value. Assuming the camera object doesn't have a rotation other than the default, setting it to a larger Y position will make the Hero appear where you want in the Viewport (in this case at the bottom). Since the camera is a child of the Hero, it will continue to automatically follow him around, even with this new position. Are you saying to increase the value of the Y in the Normalized View Port? I can't set it any higher than like 1.0 and I'm not seeing any difference. As for like the y-axis of the camera, that doesn't make sense to me since it will rotate the camera...
Apr 29 '12 at 05:36 PM
Dr_GeoFry
Additionally, can one camera follow two gameObjects?
Apr 29 '12 at 05:50 PM
Dr_GeoFry
@ the first comment, you want to increase the Y Position value in the Transform component of the camera. It will move it "up" relative to its parent object. The only way it rotates is if you change the Rotation values in the Transform, or its parent object rotates (in the same way). @ the second comment, each camera will only ever be looking at one object or in one direction at a time. It could be possible to have two objects/directions be the focus, but the camera would have flip back and forth between them.
Apr 29 '12 at 06:52 PM
dwsarber
Thanks, man. Very helpful.
Apr 29 '12 at 07:20 PM
Dr_GeoFry
(comments are locked)
|

Could you clarify what you mean by having the camera "at the bottom of the screen"? The camera essentially "is" the screen, so it's a little unclear as to what you're attempting to do.
So, within the frame, I want the hero to stand on his platform on the bottom of the frame. Right now, the hero stands on the platform which is in the center of the frame. Does that make sense?
Ahh, yes, that helps a great deal. One further question: Is the camera a child object of your Hero in the scene hierarchy?
Yes, the camera is a child of the hero. It is connected to the hero via an empty gameObject. So it is Hero>>GameObject>>Camera.