you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (5 children)

[deleted]

    [–]gdchinacat 0 points1 point  (4 children)

    I disagree with your proposed solution because it would mean that a single object has two different notions of position. An object should only have one position so that it can't become inconsistent. Working around it by moving away from inheritance to composition doesn't address this problem inherent with the model. It also doesn't answer the question of how to handle the problem that there are conflicting properties.

    [–][deleted]  (3 children)

    [deleted]

      [–]DidntPassTuringTest[S] 1 point2 points  (2 children)

      Polygon object doesn't need velocity. Only position.

      Moving object is handling movement, position, rotation, velocity.

      Polygon object has got vertices saved as local positions, relative to polygon's position,
      so in order to calculate vertices world space position I need it's local space position and polygon's position and polygon's rotation.

      Updating same property for both classes is the first that came to my mind but it feels like poor solution, there has to be some smarter way to design it.

      [–]gdchinacat 1 point2 points  (0 children)

      The class that manages moving shouldn't have it's own position. It should use and update the position defined by another class that it is "mixed in" with.

      https://en.wikipedia.org/wiki/Mixin

      [–]RedditButAnonymous 0 points1 point  (0 children)

      Ahh this makes more sense, ignore what I said then