Hello there.
My game involves entities which moves, rotate, often with different rotation centres, and has to carry around several sub-entities that also has to carry sub-entities.
On big frameworks (unreal engine, Unity, etc...) the solution is easy, there is always a kind of scene graph and rotating the root component makes everything dependant move accordingly like magic.
From my research, there doesn't seems to be any transform component/class ready to use for love2d in the libraries.
The only ones I found on the forums are here and there, and neither looks like they are widely used, or usable for the masses ?
1st question : did I miss it ?
2nd question : If I don't use one, is there some alternatives ? (Or what are you using instead of a transform component ?)
transform component ? (Or alternative to using one)
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- lots_of_birds
- Prole
- Posts: 13
- Joined: Sun Dec 11, 2011 12:09 pm
Re: transform component ? (Or alternative to using one)
There are no such things as components or scene graphs in love, love is a framework, not an engine.
Read up on "opengl transforms" or "transform matrices"; they "stack" automatically. You will also need to use live.graphics.push/pop.
Read up on "opengl transforms" or "transform matrices"; they "stack" automatically. You will also need to use live.graphics.push/pop.
Re: transform component ? (Or alternative to using one)
Yep there's no scenegraph provided with Löve and I didn't found any good library for it too, so for my projects I created a custom one (I worked a lot with OpenSceneGraph so it's mainly inspired by it). It's not a lot of work, you'll need specialized Node classes (Groups, Transforms, Geometries, etc...) and Visitors (mostly draw and update ones) encapsulating Löve features. For instance on my Transform node, when a visitor enters it applies all the transforms:
And when it exits, it just pops its state:
Code: Select all
love.graphics.push()
love.graphics.translate(...)
love.graphics.rotate(...)
love.graphics.scale(...)
Code: Select all
love.graphics.pop()
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 5 guests