Rotating wheel which doesn't move position?

What would be the best way to create a wall/ rectangle which rotates but never moves? Other objects should be pushed around by it (it’s a big wheel, constructed out of two long rectangles) but it shouldn’t be pushed around by others.

Thanks!! [import]uid: 10284 topic_id: 4841 reply_id: 304841[/import]

you mean like a windmill?

i would try setting them as kinematic, maybe use a pivot joint (http://developer.anscamobile.com/content/game-edition-physics-joints) and then set an angular velocity.

“kinematic objects are affected by forces but not by gravity, so you should generally set draggable objects to “kinematic”, at least for the duration of the drag event.” [import]uid: 6645 topic_id: 4841 reply_id: 15598[/import]

I have a seesaw in my game. I create a small circle object (just because) and make it a static physics object. I then create a larger dynamic rectangle object over the top of it. What makes it a rotating rectangle which can either be moved by other objects or kick them object (when under its own force) is the pivot joint placed at the centre of the circle object. The following code is off the top of my head as I’m at work (without mac) but should give a good indication…

[lua]local circle = display.newCircle( 100,100, 5 )
local rect = display.newRect( 0,0 , 100,10 )
rect.x, rect.y = circle.x, circle.y – also colour the rect here

physics.addBody( circle, “static”, {friction=0, bounce=0, density=0 } )
physics.addBody( rect, “dynamic”, {friction=1, bounce=.2, density=1 } )

physics.newJoint( “pivot”, circle, rect, circle.x, circle.y )[/lua]
matt. [import]uid: 8271 topic_id: 4841 reply_id: 15600[/import]

Thanks! [import]uid: 10284 topic_id: 4841 reply_id: 15703[/import]