I am creating a game, and I am pretty far in it, however, there is a big problem. The coins come across the screen, and your player touches them to collect them( that’s just a part of the game ) So, the problem is, I can get them to collide, but in order to do that, I have to make one of the things( player or coins) dynamic. And I don’t want anything to be affected by gravity, so is there anything that will allow me to make a dynamic object unnaffected by anything, similar to kinematic? Thanks in advance.
try physics.setGravity(0,0) if need to cancel it for entire world
or body.gravityScale=0 if to cancel just for specific body(ies)
I did. What happens is if there’s no gravity it floats.
You can use object.gravityScale to change an object’s gravity.
http://docs.coronalabs.com/api/type/Body/gravityScale.html
Rob
then i must’ve missed the point, as i thought that’s what you asked for, since “unaffected by gravity” implies “float”
I tried this, and the problem is I don’t want it to be affected at all. I want it to be dynamic, cause I need it to be, but I don’t want it to be affected by any physics. Is it possible to have a dynamic physics object unnaffected by physics?
Sorry for being unclear. At the end, though, I said unaffected by anything. Sorry, though.
I haven’t exactly got what you’re trying to achieve, but might the .isSensor property work?
.isSensor will allow your object to register collisions, but they won’t be affected by the actual physics world (when colliding, they will pass through other objects, without moving or moving the other objects) If you also want your coins to float and not fall, you can set them to “static”, or set their gravityScale to 0.
It’s done with object.isSensor = true.
Hi, thanks for taking the time to reply. I applied isSensor to the coins, but now, the collision doesn’t work.
try physics.setGravity(0,0) if need to cancel it for entire world
or body.gravityScale=0 if to cancel just for specific body(ies)
I did. What happens is if there’s no gravity it floats.
You can use object.gravityScale to change an object’s gravity.
http://docs.coronalabs.com/api/type/Body/gravityScale.html
Rob
then i must’ve missed the point, as i thought that’s what you asked for, since “unaffected by gravity” implies “float”
I tried this, and the problem is I don’t want it to be affected at all. I want it to be dynamic, cause I need it to be, but I don’t want it to be affected by any physics. Is it possible to have a dynamic physics object unnaffected by physics?
Sorry for being unclear. At the end, though, I said unaffected by anything. Sorry, though.
I haven’t exactly got what you’re trying to achieve, but might the .isSensor property work?
.isSensor will allow your object to register collisions, but they won’t be affected by the actual physics world (when colliding, they will pass through other objects, without moving or moving the other objects) If you also want your coins to float and not fall, you can set them to “static”, or set their gravityScale to 0.
It’s done with object.isSensor = true.
Hi, thanks for taking the time to reply. I applied isSensor to the coins, but now, the collision doesn’t work.