Moving rotated platform

Hey guys,

I’m messing around with the Game Edition, and trying to figure out different types of collisions.

I have a platform that is rotated -60 degress like: / and It moves left and right. When I drop the ball and it collides with the platform as it is moving left, the ball moves up the platform, which I don’t want to happen at all.

It seems that no matter what density/friction I set, I can’t ever get the ball to act normal, the collisions and movement always seems erratic with the moving rotated platform.

Thanks for any help that anyone can offer!

// red. [import]uid: 7143 topic_id: 2761 reply_id: 302761[/import]

I’ve been playing around with this, and when I rotate the platform to 90 or 270 degrees (so that It is vertical) if the ball collides with the platform, then it *sticks* to it.

Can anyone offer any support? Here is my code:

[code]
local onRight
local onLeft

function onRight( movingPlatform )
transition.to(movingPlatform,{time=2000,x=60,onComplete=onLeft})
end

function onLeft( movingPlatform )
transition.to(movingPlatform,{time=2000,x=260,onComplete=onRight})
end

movingPlatform = display.newImageRect( “images/platform.png”, 100, 26)
movingPlatform.x = 220
movingPlatform.y = 200
movingPlatform.rotation = 270
transition.to(movingPlatform,{time=1000,x=260,onComplete=onRight})
localGroup:insert(movingPlatform)
physics.addBody( movingPlatform, { density = 1, friction = 0.2, bounce = 0.1 } )
movingPlatform.bodyType = “static”
character = display.newCircle(40, 30, 20)
character:setFillColor(35,95,185)
localGroup:insert(character)
physics.addBody( character, { density = 1, friction = 0.1, bounce = 0.4, radius = 20 } )
character.bodyType = “dynamic”

[/code] [import]uid: 7143 topic_id: 2761 reply_id: 8335[/import]

I had the same problem. I think it has to do with the Physics engine not cooperating with translate movements or rotation movements. Try setting the object’s AngularVelocity to rotate it instead.

http://developer.anscamobile.com/reference/index/bodyangularvelocity [import]uid: 2787 topic_id: 2761 reply_id: 8619[/import]

Yes, in general you want to avoid using using transitions with physics objects. In this case, you might use setLinearVelocity() on the platform object instead of transition.to.

https://developer.anscamobile.com/content/game-edition-physics-bodies#body:setLinearVelocity

Tim [import]uid: 8196 topic_id: 2761 reply_id: 10132[/import]