Giter Club home page Giter Club logo

Comments (14)

Dgame avatar Dgame commented on May 24, 2024

Per default, Dgame uses the top left corner as origin point. You can change that by calling setRotationCenter (which only affects the rotation origin) or by calling setOrigin (which changes the whole origin, so as well the position. Or did I misunderstand you?

BTW: setRotationCenter expect the local center.

from dgame.

no-glue avatar no-glue commented on May 24, 2024

the end result should be moving object aligned with vector (and there are multiple objects). any idea how to do that? so for i tried setting rotation center at one vertex of an object but it not work. objects drift apart with time.

from dgame.

Dgame avatar Dgame commented on May 24, 2024

I don't understand what you mean by "aligned with (a) vector". Could you give me an example?

from dgame.

no-glue avatar no-glue commented on May 24, 2024

an example https://processing.org/examples/flocking.html. all objects are aligned (facing same direction) as their velocity vector.

from dgame.

Dgame avatar Dgame commented on May 24, 2024

Ah, without overlaping, I see. You could let them move in the same direction with your own offset between the objects. Wouldn't that be an option?

from dgame.

no-glue avatar no-glue commented on May 24, 2024

yes i just need correct orientation.

from dgame.

Dgame avatar Dgame commented on May 24, 2024

What's about setting the center of your object as rotation origin and use for all objects the same rotation direction?

from dgame.

no-glue avatar no-glue commented on May 24, 2024

i was thinking the same thing. could not get it working with setRotationCenter. maybe it will work with setOrigin?

from dgame.

Dgame avatar Dgame commented on May 24, 2024

What was the problem?
An example code snippet of your try would be helpful.

from dgame.

no-glue avatar no-glue commented on May 24, 2024

i used upper left corner of an object as rotation center. this changes as object moves so objects were drifting apart too much.

from dgame.

Dgame avatar Dgame commented on May 24, 2024

Try getClipRector getVertexRect, that wil give you the surrounding rect. On this you can call getCenter to ascertain the center point of your object.

from dgame.

Dgame avatar Dgame commented on May 24, 2024

I would suggest that you look at atan2 for the rotation part.

from dgame.

Dgame avatar Dgame commented on May 24, 2024

Did it work?

from dgame.

no-glue avatar no-glue commented on May 24, 2024

yes it worked

from dgame.

Related Issues (20)

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.