I have an physics object. Also, I have it set up where you press once it gets bigger, removes physics then adds back again. My problem is when new physics body being added the radius stays the same as it was. I'm trying to figure out a formula where the radius will be according to new size.
Any help?
Thanks
Label: corona android iphone ipad building error inmobi problem display screen View image tableView failed object physics touch button game lua config event listener |
Math help
The image, is it a circle or a square? If it's a circle you can grab its radius or if it is a square shape (but you want a circle body) you could set the new body radius to obj.width/2.
EG;
1 2 3 4 5 6 7 8 9 10 | display.setStatusBar (display.HiddenStatusBar) -- Set up physics require ( "physics" ) physics.start() physics.setGravity( 0, 0 ) physics.setDrawMode ( "hybrid" ) local box = display.newRect( 100, 100, 40, 40 ) physics.addBody(box, {radius=box.width/2}) |
Thank you so much! The solution is so simple. lol
I have spend few days on this trying to figure out. Thanks you saved me bunch of time.
Not a problem - glad I could save you some time :)
views:2262 update:2012/2/13 9:11:28
热门文章
GameCenter LeaderBoards and Achievements Enabled Through OpenFeint
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed
相关文章
Error --> [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
Hide a Layer, A very, very new user question
Timer to change scene using Director Class *RESOLVED*
Kindle Fire config settings to deal with 20px Menu bar
Posting to Facebook
Corona Game Edition 2010.109 is now available
"Gates" or Doors
Trouble Overlay a button (or any Display Object) over a native.newVideo()
Variable Naming and Text Files
transparent display.newRoundedRect() with non-transparent border?
Hide a Layer, A very, very new user question
Timer to change scene using Director Class *RESOLVED*
Kindle Fire config settings to deal with 20px Menu bar
Posting to Facebook
Corona Game Edition 2010.109 is now available
"Gates" or Doors
Trouble Overlay a button (or any Display Object) over a native.newVideo()
Variable Naming and Text Files
transparent display.newRoundedRect() with non-transparent border?
corona forums © 2003-2011