the collision detection on Android 1.5 is gone [import]uid: 3686 topic_id: 1688 reply_id: 301688[/import]
Are you using the updated collision event API?
http://developer.anscamobile.com/content/game-edition-collision-detection [import]uid: 3007 topic_id: 1688 reply_id: 4959[/import]
Hi Evank. I implemeted the collisions as suggested. I still don’t know where the problem is… Run from iPhone/iPad device is detecting the collisions, but when I build and run from Android 1.5, the collisions doesn’t work. Any other advice? [import]uid: 3686 topic_id: 1688 reply_id: 5142[/import]
Hello.
I too can confirm collision detection is not working for Android. I’m building for Android 2.2 and testing on a 2.2 device. In the Droid emulator, this works properly, but not on an actual device.
Any updated information about when a fix for this will be released?
Thanks, Justin [import]uid: 8688 topic_id: 1688 reply_id: 6052[/import]
We found the problem and it will be fixed for the next drop, which will be pretty soon. [import]uid: 54 topic_id: 1688 reply_id: 6369[/import]
Great! Thank you.
Although I suspect it will not work on Android 1.5 anyways, right? [import]uid: 3686 topic_id: 1688 reply_id: 6374[/import]
Thanks for the update Eric! [import]uid: 8688 topic_id: 1688 reply_id: 6376[/import]
@Giovanni – correct, we had to drop Android 1.5 support for other reasons. They didn’t actually finish implementing OpenGL in that version, so it makes it pretty hard to support a graphics engine.
On the bright side, Android 1.6 seems to work pretty well, and most remaining 1.5 devices should be at least upgradable to 1.6. I think 1.6 is also the oldest version that’s still shipping on new devices (e.g., Sony Xperia). [import]uid: 3007 topic_id: 1688 reply_id: 6384[/import]
Here is all the code so you can see what I mean[lua]local physics = require(“physics”)
physics.start()
display.setStatusBar( display.HiddenStatusBar )
– A basic function for dragging physics objects
local function startDrag( event )
local t = event.target
local phase = event.phase
if “began” == phase then
display.getCurrentStage():setFocus( t )
t.isFocus = true
– Store initial position
t.x0 = event.x - t.x
t.y0 = event.y - t.y
– Make body type temporarily “kinematic” (to avoid gravitional forces)
event.target.bodyType = “kinematic”
– Stop current motion, if any
event.target:setLinearVelocity( 0, 0 )
event.target.angularVelocity = 0
elseif t.isFocus then
if “moved” == phase then
t.x = event.x - t.x0
t.y = event.y - t.y0
elseif “ended” == phase or “cancelled” == phase then
display.getCurrentStage():setFocus( nil )
t.isFocus = false
– Switch body type back to “dynamic”, unless we’ve marked this sprite as a platform
if ( not event.target.isPlatform ) then
event.target.bodyType = “dynamic”
end
end
end
– Stop further propagation of touch event
return true
end
rec1 = display.newRect( -60, 600, 300, 90, 123)
rec1:rotate(90)
c1 = display.newCircle( 430, 550, 30, 80 )
c1:setFillColor( 30, 30, 190 )
rec1:setFillColor( 30, 200, 190 )
– Add touch event listeners to objects
rec1:addEventListener( “touch”, startDrag )
c1:addEventListener( “touch”, startDrag )
function rec1:tap( event )
rec1:rotate( 30 )
end
– add event listener for tap
rec1:addEventListener( “tap”, rec1 )
physics.addBody( c1, { density=3.0, friction=0.8, bounce=0.2 } )
physics.addBody( rec1, “static” )[/lua] [import]uid: 15931 topic_id: 1688 reply_id: 21279[/import]
I am having trouble with this, I made a rectangle and added event listeners tap(for making it rotate) and touch(for making it draggable), and they worked fine, but when I made it’s body type static:[lua]physics.addBody( rec1, “static” )[/lua]it would fall right after I touched or tapped it. Please help
RGgamer
p.s. I know this is totally off the subject.
please look at next comment [import]uid: 15931 topic_id: 1688 reply_id: 21278[/import]