Motorjoint anchors incorrect after resaving with b2dJson

Report problems here (or use the built-in feedback dialog in the editor)
Posts: 35
Joined: Thu Nov 14, 2013 1:07 pm

Re: Motorjoint anchors incorrect after resaving with b2dJson

Post by Voptiplex »

Hi Chris,

I am not completely sure what you mean with 'collisions are not deterministic between saves'.
Could you elaborate a bit ?

Measuring & Angles:
Yes, what you have shown in the old video is part of what I had in mind.
I ususally have a reference point and now need to go a certain distance at a certain angle and place the cursor there.

For the other direction, eg. checking that my rendered object in pixels is also correct in MKS terms,
on the Mac I use the tool Pixelstick:

Pixelstick provides two handles and then shows the distance between them and the angle compared to the horizon (180 to -180 degrees). I can also set an angle and pixelStick will rotate to the requested angle.
PixelStick activates a loupe when grabbing a handle so I can position the handles nicely.
The funny lines sticking out from the handles can be deactivated, But I found it is much better for alignment than just two handles.
PixelStick tool
PixelStick tool
Pixelstick.png (58.94 KiB) Viewed 11601 times
PixelStick also supports scaling to Google Maps, Photoshop and stuff.
I use the custom scaling feature which I set with my meter-to-pixel ratio to check my app display with correct scaling.
Sometimes I even set the scaling to the zoom factor in RUBE and check what I have done in RUBE.
(In the screenshot scaling is set to Custom and and Rube zoom of 70 pixels per meter)
All this would be much easier if Rube could help with the measurements

Using three points which would be the span angle, which is also nice ... ;-)

Thanks for taking so much time to listen to my ramblings !!!

Best regards,

PS: Was re-reading your collisions tutorial and found a nice typo:
.... you can use IsTouching() to check. Moron that later.

Nice ! ... Did you place it there on purpose ... ?
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Motorjoint anchors incorrect after resaving with b2dJson

Post by iforce2d »

There are many things in Box2D that depend on the order of internal lists of bodies, fixtures, joints. For example, continuous collision detection moves each body and checks if it will collide with something during the movement. The outcome will be different depending on which body moves first. When detecting which fixtures overlap and calling your BeginContact callback etc, the order the contacts are reported to you depends on the order of that internal list. When solving the joint and contact constraints, I would think the order of the joint list might have some affect too. The point is, you should not rely on any of this internal info being in any specific state. If you google "box2d deterministic" you will see many years of discussion on this :)

Wait a minute.... when you say "measure", I thought you have something made already, and you want to know the distance or angle of some parts of it. But from your last post, it sounds more like you don't have something made yet, and you already know the distance and angle you want to create it with. If the latter is what you mean, you might be able to make use of the 'step size' settings in the Controls tab of the Options dialog, where you can set discrete units for movement and rotation etc. There is also a toggle button in the tool bar (two buttons with magnet and grid icons), where you can select to have this movement based on an absolute grid, or relative to the starting point of the movement. This will also apply to the cursor as well.
For angles, maybe you could have a temporary body that you use as an aligner, and set the angle of that so you can see where things should go. Sometimes I use a body with an edge fixture, with one vertex at 0,0 and the other vertex I set to x,0 where x is some distance I want, then I can rotate that body to get the angle I want, and in vertex edit mode to C,S to put the cursor at the end of the line.
Post Reply