Hi giderians!
Just wondering if there were any Box2D solution in Gideros for creating/emulating a body 3D-movement. Let's say throwing a ball, just moving from up to down with a parabolic movement like in the ARBasketball app:
http://appcodingeasy.com/App-Reviews/ARBasketballOne way it would be the scaling of fixtures, but it's a limitation of Box2D:
http://giderosmobile.com/forum/discussion/comment/10950Another way maybe to zoom into scene (or camera, ...) ?
Any ideas?
Thanks in advance,
David (
@simplesapps)
Comments
Currently I have not seen any hacks of using it for 3d approach
If you would only need to emulate behavior and not real 3d collision, it might be possible to animate something to match the possible trajectory, etc. But only emulate, and not generate or follow trajectory.
https://github.com/gideros/gideros
https://www.youtube.com/c/JohnBlackburn1975
@ar2rsawseen And what about gtweening the object (scaling it) during their movement?
I saw an example under CodingEasy. Why do you say it would be very inefficient?
Emulating would be good. But how could be implemented an emulating behavior to match a possible trajectory? Could you post a code snippet for a ball with such movement?
@john26 Regarding 2.5 d system (pseudo-3D), yes it's not I meant because I'll have to redraw all the stuff under a graphical projection.
https://play.google.com/store/apps/developer?id=SimplesApps
http://www.amazon.com/gp/mas/dl/android?p=com.simplesapps.actionbasket
https://itunes.apple.com/artist/david-rodriguez/id763996989
One option is to use a discrete set of 3D points and precalculated their ortogonal projection (x,y) on memory. For example the trajectory could be a set of 10 or 20 3d-points and calculate their (x,y) coordinates on the screen before using to give a movement sensation in 3D.
Another option is to use a set of gtween like this:
-- The ball has been thrown
function Ball:into_hoop2()
local tween1 = GTween.new(self, 0.7, {rotation = 360, y = 20, scaleX=0.6, scaleY=0.6}, {ease = easing.linear})
local tween2 = GTween.new(self, 0.5, {rotation = 0, y = 110, scaleX=0.46, scaleY=0.46}, {ease = easing.linear, autoPlay = false})
local tween3 = GTween.new(self, 1, {rotation = 360, y = 590}, {ease = easing.linear, autoPlay = false})
local tween4 = GTween.new(self, 1.5, {rotation = 0, y = 650, scaleX = 1, scaleY = 1}, {ease = easing.linear, autoPlay = false})
tween1.nextTween = tween2
tween2.nextTween = tween3
tween3.nextTween = tween4
end
Of course, forget collision with box2d, you have make collision detection with your own functions.
"3D-movement for a body in a Box2D world"
I think of a Sumo Wrestler doing a Hula Hoop on a Flat Screen Television set.
:P
http://artleeapps.com/
Bubble Adventure - Colors
And about inefficiency, well, it destroys and recreates the fixture of the body, thus not only it is inefficient from the processing point of view, it might also break the original physical behavior (applied force according to the mass, etc) and may lead to errors in collision detection (changing fixture while in collision)