Physical object with a non-rotating picture

Hi.

I want to realize the ball with glare. The ball should behave like a standard physical object. Physic body - display group (ball+glare). Glare must be on the ball and do not rotate. How can I accomplish this? Or how can I prevent the rotation of one object in the physic display group?

If you do glares individual objects and change their position in accordance with the coordinates of the balls like this:

local listener = {}
function listener :timer( event )
      for i =1, maxBall do

            glare[i].x = ball[i].x 

            glare[i].y = ball[i].y
      end

end

timer.performWithDelay( 10, listener)

application begins to slow down.

Thanks.

P.S. Sorry for my bad english.

Hello @paisaev,

Can you show a screen sample of what you want to accomplish?

Also, what is your native language? Can you please post your request in your language, and I will try to interpret.

Sincerely,

Brent Sorrentino

I think you want to put the glare image inside the display group which is a physics object. You will be able to keep the glare in the same position/rotation relative to the stage - not rotating with the physics object - if you use an enterFrame listener on the Runtime object. It’s better to update every object with a glare with the same listener and not to have multiple enterFrame listeners, for performance. I can provide code if you need it.

Мой родной язык русский. Вопрос заключается в том что я хочу сделать шар с бликом. Шар должен двигаться как физический объект, и должен вращаться. Блик же не должен вращаться но должен всегда быть в одном месте относительно шара. Блик и шар являются объектами одной физической display group. Могу ли я как то запретить вращение одного оюъекта внутри группы?

[quote name=“horacebury” post=“183295” timestamp=“1369419904”]I think you want to put the glare image inside the display group which is a physics object. You will be able to keep the glare in the same position/rotation relative to the stage - not rotating with the physics object - if you use an enterFrame listener on the Runtime object. It’s better to update every object with a glare with the same listener and not to have multiple enterFrame listeners, for performance. I can provide code if you need it.[/quote] Can i do this without using runtime listener?

Not really. The Runtime object provides the enterFrame events. I would do it like this:

enterFrameUpdateList = {} function enterFrame()     for i=1, #enterFrameUpdateList do       local obj = enterFrameUpdateList[i]       obj:enterFrameUpdate() -- in this function you can update whatever you need to inside the physics object     end end Runtime:addEventListener( "enterFrame", enterFrame )

Thanks horacebury.

Hello @paisaev,

Can you show a screen sample of what you want to accomplish?

Also, what is your native language? Can you please post your request in your language, and I will try to interpret.

Sincerely,

Brent Sorrentino

I think you want to put the glare image inside the display group which is a physics object. You will be able to keep the glare in the same position/rotation relative to the stage - not rotating with the physics object - if you use an enterFrame listener on the Runtime object. It’s better to update every object with a glare with the same listener and not to have multiple enterFrame listeners, for performance. I can provide code if you need it.

Мой родной язык русский. Вопрос заключается в том что я хочу сделать шар с бликом. Шар должен двигаться как физический объект, и должен вращаться. Блик же не должен вращаться но должен всегда быть в одном месте относительно шара. Блик и шар являются объектами одной физической display group. Могу ли я как то запретить вращение одного оюъекта внутри группы?

[quote name=“horacebury” post=“183295” timestamp=“1369419904”]I think you want to put the glare image inside the display group which is a physics object. You will be able to keep the glare in the same position/rotation relative to the stage - not rotating with the physics object - if you use an enterFrame listener on the Runtime object. It’s better to update every object with a glare with the same listener and not to have multiple enterFrame listeners, for performance. I can provide code if you need it.[/quote] Can i do this without using runtime listener?

Not really. The Runtime object provides the enterFrame events. I would do it like this:

enterFrameUpdateList = {} function enterFrame()     for i=1, #enterFrameUpdateList do       local obj = enterFrameUpdateList[i]       obj:enterFrameUpdate() -- in this function you can update whatever you need to inside the physics object     end end Runtime:addEventListener( "enterFrame", enterFrame )

Thanks horacebury.