Comments (14)
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.
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.
I don't understand what you mean by "aligned with (a) vector". Could you give me an example?
from dgame.
an example https://processing.org/examples/flocking.html. all objects are aligned (facing same direction) as their velocity vector.
from dgame.
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.
yes i just need correct orientation.
from dgame.
What's about setting the center of your object as rotation origin and use for all objects the same rotation direction?
from dgame.
i was thinking the same thing. could not get it working with setRotationCenter. maybe it will work with setOrigin?
from dgame.
What was the problem?
An example code snippet of your try would be helpful.
from dgame.
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.
Try getClipRect
or getVertexRect
, that wil give you the surrounding rect. On this you can call getCenter
to ascertain the center point of your object.
from dgame.
I would suggest that you look at atan2
for the rotation part.
from dgame.
Did it work?
from dgame.
yes it worked
from dgame.
Related Issues (20)
- Iterating over SpriteSheet starts at index 1 and ends at index 0 HOT 13
- small issue on page HOT 2
- [Feature Request] A Window.draw overload with an offset HOT 4
- Dgame Does not render on multiple windows HOT 3
- Make Rect a template to allow for floating point HOT 1
- Necessary code doesn't execute when compiling in release mode HOT 3
- Shape color is being changed by unrelated objects HOT 5
- TTF_Init is not being called, formatting Text always errors "Font Invalid" HOT 5
- StopWatch Divide by 0 when trying to fill frame_ms HOT 1
- DerelictGL3 not able to find symbol ( glGetnTexImage ) HOT 3
- Window.wait Timeout is milliseconds, not seconds. HOT 1
- Collision detection HOT 4
- Wrong links in README.md? HOT 1
- Dgame crashing HOT 6
- Is this project still alive ? Couple bugs I ran into. HOT 8
- What about adding more built in colors? Like 400 plus . Color Enhancement idea . HOT 8
- Rect methods questions ? Add new method clamp ? HOT 1
- `object.Error@(0): Access Violation` on `DMD32` HOT 7
- D program quits unexpectedly when using Text HOT 11
- Text colors are wrong HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dgame.