Open the DragPlatforms sample code, add the next three lines at the very end of the main.lua:
platform2.y = 350
platform2.rotation = 20
physics.newJoint( “piston”, ground,block , ground.x,ground.y , 0,5 )
If you run this in the iPhone simulator you should see the platform on the right just about the ground and tilted at 20 degrees. The question mark block should then drop down, hit the tilted platform and bounce off the right of the screen.
Now, comment out the following line, found just at the bottom of the four lines which create the question mark block:
block.isFixedRotation = true – question blocks don’t rotate, they just fall straight down
Run the simulation again and what you should see this time is the question mark block drop down, bounce on the tilted platform, wiggle in the air a little and come to rest against the tilted platform - however it will not tilt and slide off the platform like the other blocks will, if you try dragging them over the tilted platform.
My questions are:
Why, when isFixedRotation is true and a piston is connected to the block, does the piston seem to have no effect at all?
…and:
Why, when isFixedRotation is set to false (the default) and the piston is still connected, does the block fail to rotate on impact but remains on it’s piston axis?
This seems to be a bug, but (for me at least) the effect gained when having isFixedRotation=false and a piston connected is what I want in my program. The problem, of course, is that the effect we see in the DragPlatforms sample is not the effect I see in my program. What I see is the block rotating to the angle of the platform and I don’t see why that is not happening with the block in the modified sample.
Thanks,
Matt. [import]uid: 8271 topic_id: 2546 reply_id: 302546[/import]