Giter Club home page Giter Club logo

Comments (2)

stephanbogner avatar stephanbogner commented on May 20, 2024

Some thoughts:

  1. Matter.js has something similar like a camera because in the Renderer you can set what the renderer should look at
    • But if I understand correctly we are using P5 as a renderer, so that functionality is not available to us
  2. If I understand the example @b-g posted correctly, they are just using translate and scale on the canvas context to simulate a camera
    • We could produce a similar result with push/pop as this apparently is what p5 is doing under the hood anyways
    • I don't know how well this would translate into a class though ... as the push would have to happen at the beginning of the draw and pop at the end
    • For the parallax example I now used push & pop without a camera class and it works fine (and is in line to what the folks have learned in the rest of the semester) ...
    • ... but I'd imagine that it would interfere with coordinates from mouse input, like in 6-add-remove-bodies (but I have not verified how mouseX/mouseY works in combination with push/pop/scale)
    • I think the fundamental problem is that p5 doesn't have the concept of viewports/cameras
      • It's quite sad, because in game engines like in Godot this is basic stuff

→ I am not sure how feasible it is to add a camera class with our P5 + Matter setup :(
(At least one which doesn't interfere with mouse input and/or isn't super weird to use ... or am I missing something?)

from p5-matter-examples.

stephanbogner avatar stephanbogner commented on May 20, 2024

Nevertheless, ground work can be found in the new camera follow example.

from p5-matter-examples.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.