I have a problem with this code - when I spin the rotating physics object (“spinner”), the text in the welded text object disappears. In hybrid mode the orange outline of the text object remains visible and spins along with the “spinner,” but the actual letters are no longer visible. You can cut and paste to view if you have a second and want to look. I’m new to the physics stuff and I’d appreciate any thoughts.
[lua]local physics = require “physics”
physics.start()
physics.setGravity( 0, 0 )
physics.setDrawMode( “hybrid” )
display.setStatusBar(display.HiddenStatusBar)
local background = display.newRect ( 0,0, 800, 1400 )
background:setFillColor(250,250,250)
local spinner = display.newCircle( 200, 750, 600 )
spinner:setFillColor(0,0,0)
physics.addBody( spinner, { radius = 600 } )
local textObject4 = display.newRetinaText( “Test the Text”, 300, 750, nil, 40 )
textObject4:setTextColor( 250,250,250 )
physics.addBody( textObject4 )
myJoint = physics.newJoint( “weld”, textObject4, spinner, 300,750 )
local velocityVar = nil
function background:touch( event )
if event.phase == “began” then
firstTime = (event.time/1000 )
startPos = event.y
elseif event.phase == “moved” then
endPos = event.y
lastTime = (event.time/1000 )
finalLength = endPos - startPos
finalTime = lastTime - firstTime
velocityVar = (finalLength / finalTime) /5
spinTimeVar = velocityVar * 4
if velocityVar > 0 then
spinner.angularVelocity = velocityVar
end
elseif event.phase == “ended” then
spinTimeVar = velocityVar * 4
dampVar = .25
local function stopIt (event)
spinner.angularDamping = dampVar
end
timer.performWithDelay ( spinTimeVar, stopIt)
end
return true
end
background:addEventListener( “touch”, background )
[/lua]
[import]uid: 96383 topic_id: 19719 reply_id: 319719[/import]