Closed vsidou closed 9 years ago
Well, It is actually by chance you got it there (in the center). :dart: The scaling in your graphic made it easier for confusing you.
If you want turn on the debugDraw which is in the UI.qml in the element PlayerHUD there is a debugDraw. Maybe Using a simpler object you could find out. Change the positions where ever you find good to see that, try this one:
Actor{
id:actorShowOff
x: 10.592566
y: -23.612015
CircleBody{
active: true
radius: 0.5
}
ImageRenderer {
cacheRenderParams: actor39986.body.bodyType === Body.StaticBody
id: graphic2
// sizeScale: 23.742374
source: Util.getPathToImage("background_mp/bg_mp1_flat.jpg")
}
}
Feel free to ask any questions.
Hi,
Based on the cameraBoundary : Qt.rect(0.21014, -24.2574, 20.7089, 11.6926)
I get the rect.center() ==> QPointF(10.5646, -18.4111)
I defined these values as the X/Y of the Actor you gave as an example.
And it truly set the object on the center :) thanks.
But i wonder for the previous Actor (Polygon actor) which display a background image on the Level, i commented the sizeScale.
The object get displayed on the center of X but near the top for Y. This is understandable as Y = -23.612015
which is not the center of camera boundary.
I also noticed that the "active" property is set to false.
So in Body::updateBeforePhysics()
it doesn't call mBody->SetTransform(...)
for non active Actor.
This means the "Y" position for this kind of "Background" actor need to be quite specific based on the sizeScale of ImageRenderer.
Could you maybe explain how this "Y" is chosen for the "Background" actor please ?
Thanks you
Well as far as i know that is the default behavior in the ImageRenderer which is not so usefull. I did a little modification for this in the ImageRenderer. You can set a custom localBox to the image renderer and it does a better thing.
https://gist.github.com/adderly/48e570ba900765d5ce60
With that you could do something like:
Actor{
id:actorShowOff
x: 10.592566
y: -23.612015
CircleBody{
active: false
radius: 0.5
}
ImageRenderer {
customLocalBox: Qt.rect(0.21014, -10.2574, 10.7089, 11.6926)
cacheRenderParams: actor39986.body.bodyType === Body.StaticBody
id: graphic2
// sizeScale: 23.742374
source: Util.getPathToImage("background_mp/bg_mp1_flat.jpg")
}
}
If you want push these changes up, i got a mess in my repo. Not gonna clean that for now. :)
Hey there,
thanks i got it now. Thanks also for the update. Actually i'm learning Box2D/Liquidfun from VoltAir code. This is great starting tutorial. I hope to make one quality game like that in the near futur :)
Thanks again
Hello
one more question though before closing this topic. I was trying to understand the ParticleLayer principles on the game. So far i understand that this is were specificaly Liquidfun is being really used.
Now armed with that i manage to understand the logic behind Particles, ParticleEmitters ... But one thing is bothering me. In the multiplayer level arena.qml i can see this :
ParticleLayer {
id: particleLayer0
radius: 0.075
}
ParticleLayer {
id: particleLayer1
}
ParticleLayer {
id: particleLayer2
}
ParticleLayer {
id: particleLayer3
}
but only particleLayer0 seems to be used. I don't really see where layers 1 to 3 are being used. Could you point me on the right direction for this please ?
THanks
I don't know what they are doing there. Try deleting them and if it runs normaly then you're good to go.
Yeah
Strange they seem not to be needed. Maybe they were added using the level editor... Thanks for the answer
Hi,
I've been digging in VolAir code and trying to understand the coordinated defined in the levels. As i read in the FAQ it seems the level editor is and will not be released which is understandable. My question is with the Multiplayer level. I choosed it because it fill the camera.
I simplified the level with the simple background here :
From the Box2D documentation when positionning a Body (Polygon here) we always define its center. From the source code CameraBoundary is also defined as world coordinates. Even armed with that i cannot understand how Polygon ( x: 10.59256, y: -23.612015) is on the center.
Could someone maybe explain this process slowly and nicely for me please ? :)
Thank you