Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Why physics engine summate the direction of the vectors?
Started by stalxerhd Jan 13 2020 11:51 PM

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

stalxerhd

[GLOBAL: userInfoPane.html]
stalxerhd
  • Enthusiast

  • 44 posts
  • Corona SDK

In my game, the physics engine is periodically paused/started via commands physics.start() and physics.pause().
 
When the game works, there are no big problems with the direction of the object; in 99% it always moves to the point, pressed on the screen. The same be, if at the time of a pause press once on the requested point on the screen.
 
But, if I make several clicks on pause...
 
for example, the first tap on position #1 and after 1-2 seconds more accurate second tap on position #2 - I had shown it on a figure
 
...after continuing the physics engine will send the object to the resulting vector of tap1 and tap 2, instead of just sending an object to position 2.
 
When tap happens, I always reset the current state of the object via setLinearVelocity00), so, when the second tap happens, it should forget first.
 
Did I do smth wrong or how to set physics engine process only the latest callout, when it paused?
 
P.S. the object has a dynamic physical type.
 
Attached File  1.png   6.08KB   0 downloads


[TOPIC: post.html]
#2

stalxerhd

[GLOBAL: userInfoPane.html]
stalxerhd
  • Enthusiast

  • 44 posts
  • Corona SDK

Update. The same problem happens when I using touch () instead of tap () on pause. But I found a different way, reworked the game control, switched to touch () and use the auto-continue after screen pressing from pause.



[TOPIC: post.html]
#3

sporkfin

[GLOBAL: userInfoPane.html]
sporkfin
  • Contributor

  • 816 posts
  • Corona SDK

Questions:  

 

1) After physics resumes, does the object move twice as fast along the new vector between tap1 and tap2?

or

2) After physics resumes, does the object move about 40% slower along the new vector between tap1 and tap2?

 

 

*My numbers based on tap positions (and rough angles shown in the illustration)




[topic_controls]
[/topic_controls]