it use critical section because newton is a multithreaded engine. that function write to the body so to be save is belter to prevent other functions from use that body.
it turn out that in that example is no necessary, however if you run the engine on a separate thread then It may be that some other thread be try to read for a body that is being modified.
arg :/ I can't add the callback directly to the script code. I should manage the threading everywhere. I'l make this another way with a listener on body. but the mouse informations will be taken only one time per render frame.
can we check the scaling issue and go back on this later ? I'll have to think more on this.
F5 : (slow in debug) you can grab closes objects with mouse click the right glass door have continuous collision enable when you rush into it the bad thing happen ^^ t
what is the bad thing? can you make a build that does no render all that debug wire frame stuff, it Is unplayable?
what do you mean rush into it, just walking into the door? I see tow doors one is partially open, but is so slow that I do not know what is going on. Make a build without debug lines.
also all newton call back are called from a separate thread, so if you can deal with force and torque and joint callback, the you can deal with the pre and post listener.
I did that, but it is still too slow. anyway I when trough the door few time, and I did no see anything. I see that the capsule veer to the left and if it was scraping the door. what it is that I am suppose to see? maybe compile it is release mode, because I can not move or do anything.
sometime when the door make the contact with the camera body, the camera just fly away and i get an assert because of an enormous velocity on the camera. I really don't know how this can happen. this thing must be related to the joints and it seems to happen with continuous collision.
when you made the change can you make so that on the test, there are only the relevant objects. the doors and the player. the rest of the stuff is no relevant for debugging the problem
how you make the player? Is this another body that you are simple moving by setting the position or velocity?
when you come close to a collision, with right click you send balls. Then when the ball bounce on the wall and get back to the camera collision some times the camera just bounce away.
Oh I see, Ok I will add a modified one. does the new function works better?
you can make tweaks, for example you can take the angular damp which is hard code to 0.95 now and make a parameter, that way you can control the amount of spin the body does when you drag it. 1.0 full spin, less that 1.0 form light to heavily damped.
I will make a function that takes a target matrix and tune into an angular impulse just like that one
Yes I already set the stiffness as a parameter, but I don't use the collision point yet. I prefer the effect it does with a spring joint as I cant set more parameters on it. but I use this function to move the body added on the mouse position.
For the case discussed before about the camera body going crazy, I was able to make a very basic scene where the problem occur once it start and with only 2 bodies + the camera shell body and the camera body with the joint.
here a box collision just fall near the camera body and when it touch it the camera body go to heaven.