WombatTurkey Posted June 5, 2016 Share Posted June 5, 2016 I'm curious, if there is a responsiveness difference between doing: A KEY: (Move to the Left) Quote PlayerSprite.body.velocity.x = -200 vs Quote PlayerSprite.x -= 30 I'm doing some testing now, and it seems like this way would be easier for me to handle server-side since I don't have to mess around with the arcade physics within node... But I am not sure if this has the same type of movement/responsiveness feeling as arcade physics. It's hard to explain, but are they basically the same, (except for the physics)? I'm not noticing anything really different.. This is all run within RAF, under my update method. Both seem fluid.. Hmmm Umz 1 Link to comment Share on other sites More sharing options...
Taggrin Posted June 6, 2016 Share Posted June 6, 2016 I recently came to this point as well when making a game with moving walls. When I used the 2nd option the player occasionally clipped through the wall. This wasn't the case when using velocity. In both cases the movement looked the same and went smooth. Not sure if this only happens at specific speeds (for met it was -75 I believe). In general I just use the velocity to move objects while I use the other one to teleport objects. It all depends on your needs though. If you don't want to use arcade physics and it works, I would say why not. WombatTurkey 1 Link to comment Share on other sites More sharing options...
WombatTurkey Posted June 6, 2016 Author Share Posted June 6, 2016 10 minutes ago, Taggrin said: I recently came to this point as well when making a game with moving walls. When I used the 2nd option the player occasionally clipped through the wall. This wasn't the case when using velocity. In both cases the movement looked the same and went smooth. Not sure if this only happens at specific speeds (for met it was -75 I believe). In general I just use the velocity to move objects while I use the other one to teleport objects. It all depends on your needs though. If you don't want to use arcade physics and it works, I would say why not. Thanks! Yeah,I'm doing more tests now and it seems like I am not noticing anything too weird. I'll use this way for now. It makes it extremely easier inside node Link to comment Share on other sites More sharing options...
drhayes Posted June 6, 2016 Share Posted June 6, 2016 I'm not sure what you mean by responsiveness, but if you directly change the position of an object under control of the physics system you might slingshot it away. The physics system sees a delta from the old to the new position and says, "I guess that's the new velocity!" and WHOOSH -- away it goes. Additionally, in Arcade physics, only bodies with velocities can collide. But nothing says you have to always use a built-in physics system, especially if your needs are better handled elsewhere. Tilde, SkyzohKey and WombatTurkey 3 Link to comment Share on other sites More sharing options...
lewster32 Posted June 8, 2016 Share Posted June 8, 2016 When using the physics system, you should always move an object via its body's velocity if you want physics to behave correctly. If you want to directly move an object absolutely, ensure body.moves is set to false first so the physics system doesn't do what @drhayes mentions above and interpolates the position change into a new velocity for the object; this is what causes objects to go flying off the screen or vibrate crazily when people attempt to tween them or otherwise directly specify their positions. WombatTurkey and drhayes 2 Link to comment Share on other sites More sharing options...
Recommended Posts