Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

How to make physical object respond to collisions but not to gravity.
Started by sheikhameen123 Mar 23 2019 08:25 AM

2 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

sheikhameen123

[GLOBAL: userInfoPane.html]
sheikhameen123
  • Observer

  • 23 posts
  • Corona SDK

Gravity shouldn't exist in the game I am trying to build.

"physics.setGravity(0,0)" or "object.gravityScale = 0" doesn't work as expected because of... Newton's first law of gravity: An object will remain at rest or in uniform motion in a straight line unless acted upon by an external force. I don't want it to move in a uniform motion in straight lines or whatever... I want the object to stop moving on key event's " (event.phase == "up") ". Setting velocity = 0 doesn't work here. Because of Newton...Thanks to him and his first law.  :) 

But I do want the static objects to remain static and my other physical objects to detect collisions... Or is there any other ways to achieve this without using the physics engine..? :) 



[TOPIC: post.html]
#2

dodi_games

[GLOBAL: userInfoPane.html]
dodi_games
  • Contributor

  • 370 posts
  • Corona SDK

if you want that behavior you should not use box2d, because of Newton's first law.


  • sheikhameen123 likes this

[TOPIC: post.html]
#3

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,801 posts
  • Enterprise

You might want to look at http://docs.coronalabs.com/tutorial/games/nonPhysicalCollision/index.html

 

Rob




[topic_controls]
[/topic_controls]