Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3303538
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:58:03+00:00 2026-05-17T20:58:03+00:00

I have Camera class, which handles camera behavior. Among it’s fields is a reference

  • 0

I have Camera class, which handles camera behavior. Among it’s fields is a reference to the target’s Cube class (Cube is just one of the object, but I won’t mention others to keep it simple). In order to calculate the View matrix, I need the camera’s position and target’s position, so I can explain to my program that: “the camera is placed here, and from here it’s looking at this cube”. Should the cube happen to move around, so too would the camera’s point of view change automatically.

So far, everything is good: there is a Camera class which depends on the Cube class, and there’s the Cube class which depends on nothing (in this example).

I get to a problem when I need to draw a cube, or anything else — in order to draw something, among the required values it the View matrix of the Camera; that’s the one that I’ve just calculated in the first paragraph. In essence, this means when I get to the point to draw things on-screen, the Cube class becomes dependant on the Camera class as well, and they’re now dependant on each other. That would mean that I either:

  1. need to make the View matrix field of the Camera class static, so I can access it directly from the Cube class.
  2. need to make a method (eg. SetView) in Cube class, which I can then invoke from the Camera class (since I already have it’s reference there).
  3. need to keep a View matrix in outside scope.
  4. need to make a bidirectional dependency.

But, I don’t like either of these:

  1. there are more cameras which handle multiple views (currently there are 3 of them on-screen) and there may be more (or less).
  2. this makes the code slightly (sometimes, maybe, very) unreadable — for example when I’m drawing the cube, it’s not quite clear where the View matrix came from, you just kinda use it and don’t look back.
  3. I would access the outside scope from the camera class, or the outside scope would access the camera, and I wouldn’t like this because the outside scope is only used to handle the execution mechanics.
  4. I like to keep my reference fields “readonly” as it’s currently everywhere in this system — the references are set in the constructor, and only used to get data from referenced classes.

And, if I haven’t made it clear, let me just repeat that there are multiple Camera objects, and multiple Cube objects; whereas any Camera may or may not depend on any Cube, but usually there is at least one Camera dependent on a Cube.

Any suggestions would be appreciated 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T20:58:03+00:00Added an answer on May 17, 2026 at 8:58 pm

    If your Cube must know how to render itself with respect to a Camera (and therefore must know about the Camera), then it probably doesn’t make sense for the Camera to know how to align itself to a Cube. The alignment behavior that’s currently in Camera probably belongs in a higher-level class like a CameraDirector that knows about both Cubes and Cameras. This improves class cohesion, as it splits off some of the responsibilities of Camera into a different, tightly-focused CameraDirector class. This lets the Camera focus on its core job and makes it easier to understand and maintain.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an abstract class called camera which PointCamera uses as its super class.
Have just started using Visual Studio Professional's built-in unit testing features, which as I
i am making a app which takes photo on button click i have camera.java
I have a Camera class that produces very large images at a high FPS
I have made an openGL camera class that uses lazy evaluation to provide the
I have made an openGL camera class that uses lazy evaluation to provide the
I have a camera that returns raw images that can easily be converted to
So I have written a Quaternion based 3D Camera oriented toward new programmers so
Some SONY Cameras have a FireWire interface. Is it possible to control any camera
Have just started using Google Chrome , and noticed in parts of our site,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.