Hi guys! First of all I want to thank all of you for the help you offer here in the forum. This time I have doubt and I would like to get help. What would the best way to do a “physic joint weld” to achieve this?
The ball hits the four walls of the screen with a specific speed, but when it touches the surface of the blue square, I would like it not to move, I would like it to be welded in the center of the surface of the blue square.
to achieve it this is the code that I have:
local function jointObjects( event ) redBall.rotation = 0 --to make the image fill looks good redBall.x = blueRect.x redBall.y = blueRect.y-50 --position the redBall with the coordinates of the blueRect local joint = physics.newJoint( "weld", redBall, blueRect, redBall.x, redBall.y ) end
and I call the function on my local collision listener
jointDelay = timer.performWithDelay(1, jointObjects)
I read THIS but my
doubt is in "[font=‘Source Code Pro’]
anchor_x, anchor_y"
[/font]
[font=arial]
[font=‘Source Code Pro’]
[font=arial]
It is currently working but as it is the first time I do this I wanted to ask if it is ok.
[/font][/font][/font]
Or if there is any way to carry out this task other than using a joint?
[font=arial]
[font=‘Source Code Pro’]
[font=arial]
Thanks in advance
[/font][/font][/font]
[font=arial]
[font=‘Source Code Pro’]
[font=arial]
DoDi
[/font][/font][/font]