Ok so about 15 minutes ago, I was looking for back and forth movement of object, ok I found that here
http://developer.anscamobile.com/forum/2011/07/07/block-movement-back-and-forth This was really cool.
So then I took that code from above, added a ball and rotated the platform and *tried* to get it to act proper.
Go ahead and fire this up and you’ll see what I mean. I made sure to use generated shapes so you can just copy paste and launch.
…Assuming you have launched it by now
Ok, see how the circle just kind of sits there and then flies off suddenly or slowly slides down, or just acts WEIRD?
How do I prevent that weird behavior? I want it to GENTLY roll and act like a ball would in real life on an angled surface and rotate and react like it should.I tried isBullet I am not sure what I am doing. I do mean I don’t know what I am doing
I started with corona 2 months ago, I have a game put together and now I am adding rotating platforms, objects etc but I am stuck due to this weird behavior when round objects encounter rotating, rotated or anything moving.
Thanks for help in advance!
-Nick G.
[code]
local physics = require (“physics”)
physics.start()
physics.setDrawMode( “hybrid” )
–Object back and forth animation
–mplat = moving platform
local mplat = display.newRect( 0, 0, 250, 50)
mplat.x = 200
mplat.y = 200
mplat.rotation = 40
mplat.isBullet = true
physics.addBody( mplat, “static”, { density=1.0, friction=1.0, bounce=0 })
local circle = display.newCircle (150,0,50,50)
physics.addBody( circle, { density=2.9, friction=1.0, bounce=0.7, radius=45 } )
circle.isBullet = true
–changing time will dictate how fast the object will go left on return
function goLeft ()
transition.to( mplat, { time=1500, x=(mplat.x - 150), onComplete=goRight } )
end
– changing time will dictate how fast the object goes right on return
function goRight ()
transition.to( mplat, { time=1500, x=(mplat.x + 150), onComplete=goLeft } )
end
goLeft()
[code] [import]uid: 61600 topic_id: 13012 reply_id: 313012[/import]