I have a circle physics object and I wanted to know if there was any way to add a bulging effect so that it would look like a sphere? If not, is there any way to track a sprite of a sphere onto a physics object
Not sure about the bulging effect but you can just add the sprite using the circles location. For a demonstration add the following to the physics debug draw class in the physics demo at line 100
sprite("Small World:Heart Glow",0,0,2*body.radius)
can’t get the heart to show? What test number?
In the physicsdebugdraw class. Not in any of the tests. When you run, test1 contains a circle so should show
Or taking the demo by @Rob10 from and swapping the ellipse for a sprite (original thread http://twolivesleft.com/Codea/Talk/discussion/comment/11440#Comment_11440)
--# Main supportedOrientations(LANDSCAPE_LEFT) saveProjectInfo("Description", "Just a simple ball to bounce around.") -- Use this function to perform your initial setup function setup() parameter("GravityScale", .25, 10, 3) parameter("Restitution", 0, 1, .5) ball = physics.body(CIRCLE, 50) ball.x = WIDTH/2 ball.y = HEIGHT/2 ball.sleepingAllowed = false wall1 = physics.body(EDGE,vec2(0,0),vec2(0,HEIGHT)) wall2 = physics.body(EDGE,vec2(0,0),vec2(WIDTH,0)) wall3 = physics.body(EDGE,vec2(WIDTH,0),vec2(WIDTH,HEIGHT)) wall4 = physics.body(EDGE,vec2(WIDTH,HEIGHT),vec2(0,HEIGHT)) wall1.type = STATIC wall2.type = STATIC wall3.type = STATIC wall4.type = STATIC wall1.restitution = .1 wall2.restitution = .1 wall3.restitution = .1 wall4.restitution = .1 end -- This function gets called once every frame function draw() physics.gravity(Gravity) ball.gravityScale = GravityScale ball.restitution = Restitution background(40, 40, 50) strokeWidth(0) fill(255, 255, 0, 255) --ellipse(ball.x,ball.y,ball.radius*2) sprite("Small World:Heart Glow",ball.x,ball.y,ball.radius*2) end
@West ok thanks it worked. Now I need to find a pinball sprite