It looks like you're new here. If you want to get involved, click one of these buttons!
Mells            
            
                Guru             
            local tween = GTween.new(myBody, 1, {x = myBody:getX()}, {repeatCount = 0, setLoop = true, reflect = true})  | 
Likes: Yan
Comments
On the other hand it might not make sense to tween the bodies at all, as in, they are there for a physics purpose, and tweening might only disrupt it. But of course there can always be specific cases.
But it's actually not getX/Y needed for tweening, but just general get/set methods
I'll talk about it with @atilim, but in the mean time, you can probably do something like this:
Likes: Mells
thank you!
By the way what is the correct way to require the libs in init.lua?
I will have to search more.
Edit : I required "Box2dEasy" before "box2d" and it worked. Should I remove the require("box2d") line?
Btw @atilim I see in the docs : I see that we have a getWidth/setWidth method available.
Maybe it's worth adding "width" and "height" to the list of properties above?
- "width"
 
- "height"
 
@ar2rsawseenyes if everything (gravityScale, linearDamping, localCenter, mass) was accessible through body:set(param, value) we could for example tween the gravityScale for all objects on screen for a nice slow motion effect, etc...
BTW there is no setWidth method, only getWidth as the width of Sprite is determined by its contents. Thus you can't adjust nor tween it. Same for height.
But adjusting/tweening scale should provide similar effect.
And yes to your last comment, I'm adding this to GCE
Also I will fix so Box2dEasy would work if required after box2d. So it won't matter where you require box2d completely
BTW @Mells your provided tween gives an awesome dancing box effect
What do you think about the following :
For those who want to see how to use it :
A modified version of the physics example provided with Gideros.
About the other options, well both getter and setter is needed to tween something, and I actually don't know why most of them has only getters, maybe its a box2d limitation.
Btw how to scale a body? I have found that fixtures need to be destroyed and recreated.
Are there alternatives? I would like to tween the scaling.
For example in the collision sample provided with Gideros (and modified above), how would you scale both the crate and it's body?
That sounds trivial but I have no idea how to do it.
Unfortunately you can't really scale x or y separate in most cases, thus there is only one scaleBody property.
Updated the repo