sugarlabs / physics

a box2d playpen
GNU General Public License v3.0
7 stars 26 forks source link

Bug : Motor and pin won't work #27

Open Hrishi1999 opened 7 years ago

Hrishi1999 commented 7 years ago

Hello, I was just using Physics and I found a strange bug. Now, make a machine and erase everything. Make another machine again, stop, and then add a pin and a motor to an object. Then play, you will see that nor the motor would work nor the object would be stuck at the same place. Using physics 31

quozl commented 7 years ago

What does "make a machine" mean? I do see three of the four Show sample projects do not work and the fourth slows down and stops.

Hrishi1999 commented 7 years ago

A machine (here) like for example use circle tool and add a motor.

quozl commented 7 years ago

Okay, thanks, I've reproduced the problem from your description; there's a lot more to it;

At this point, the erase all button is not sensitive.

Workaround is to restart Physics, however a Keep Error happens during Stop.

1484166694.100760 ERROR root: Error saving activity object to datastore
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/sugar3/activity/activity.py", line 1087, in _prepare_close
    self.save()
  File "/usr/lib/python2.7/dist-packages/sugar3/activity/activity.py", line 896, in save
    self.write_file(file_path)
  File "/usr/share/sugar/activities/Physics.activity/activity.py", line 127, in write_file
    self.game.write_file(file_path)
  File "/usr/share/sugar/activities/Physics.activity/physics.py", line 89, in write_file
    self.world.json_save(path, additional_data, serialize=True)
  File "/usr/share/sugar/activities/Physics.activity/myelements/elements.py", line 481, in json_save
    worldmodel = self.get_world_model(additional_vars, serialize)
  File "/usr/share/sugar/activities/Physics.activity/myelements/elements.py", line 547, in get_world_model
    modeljoint['body1'] = joint.bodyA.userData['saveid']
TypeError: 'NoneType' object has no attribute '__getitem__'

Another workaround is to use erase ctrl+e instead of erase all ctrl+a.

Hrishi1999 commented 7 years ago

I am aware of the workaround but this gets annoying sometimes. (sorry for reopening issue, my phone screen is a bit broken and it accidentally pressed close issue:()

quozl commented 7 years ago

No worries, I wasn't documenting the two workarounds for you only, but also for everybody else. It is common for the workaround(s) of a problem to go some way toward explaining the cause.

quozl commented 4 years ago

12c5f706ad57ab236d615029021d1fc6af306bd9 fixes the traceback mentioned above, but not the other problems.