1.8.0 sripted hinge disappear
6 posts • Page 1 of 1
1.8.0 sripted hinge disappear
1.8.0
I found this trying to build very fast servomotor. Run scene and see how whole arm disappear after a few moments.
No div by 0, no error in code. It juts disappear in some unpredictable moment.
Not happened on slow speed. Weired.
The only thing I've noticed - it happened then motor speed is near zero and switches 0/-0.
[scene]47345[/scene]
I found this trying to build very fast servomotor. Run scene and see how whole arm disappear after a few moments.
No div by 0, no error in code. It juts disappear in some unpredictable moment.
Not happened on slow speed. Weired.
The only thing I've noticed - it happened then motor speed is near zero and switches 0/-0.
[scene]47345[/scene]
Dream of Algodoo as game development engine...
-

Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: 1.8.0 sripted hinge disappear
I've found the reason
And It's bad.
Shortly - because of algodoo not very precise sometimes, for example e.normal vector length can be 1.0000001
Then I try to calculate angle between current and last e.normals (call it n1 and n2) using formula
http://en.wikipedia.org/wiki/Dot_product
n1(0) * n2(0) + n1(1) * n2(1) = cos (a)
algodoo sometimes calculate it as 1.0000001
and math.acos() gives NaN.
I don't know how to handle it yet... maybe Emil can fix it somehow? for example change NaN result of arccos to 0 instead of NaN if argument > 1 (and same for other arc-functions) ?
And It's bad.
Shortly - because of algodoo not very precise sometimes, for example e.normal vector length can be 1.0000001
Then I try to calculate angle between current and last e.normals (call it n1 and n2) using formula
http://en.wikipedia.org/wiki/Dot_product
n1(0) * n2(0) + n1(1) * n2(1) = cos (a)
algodoo sometimes calculate it as 1.0000001
I don't know how to handle it yet... maybe Emil can fix it somehow? for example change NaN result of arccos to 0 instead of NaN if argument > 1 (and same for other arc-functions) ?
Last edited by Kilinich on Fri Oct 15, 2010 11:22 am, edited 2 times in total.
Dream of Algodoo as game development engine...
-

Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: 1.8.0 sripted hinge disappear
even if motor speed set to NaN it's not good to remove script and motor ad everything it connect from scene..
Dream of Algodoo as game development engine...
-

Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: 1.8.0 sripted hinge disappear
I agree, algodoo should keep a bad object in the scene so it can be fixed by the author easily.
and if it is impossible to use the bad value, make algodoo restore a valid value like it does with the text box's in the script menu.
and if it is impossible to use the bad value, make algodoo restore a valid value like it does with the text box's in the script menu.
When asking for help, READ THE STICKIES!
- electronicboy
- Posts: 1694
- Joined: Mon Aug 31, 2009 6:18 pm
Re: 1.8.0 sripted hinge disappear
Clamp = (x, min, max) =>{ x < min ? min : x > max ? max : x };
Acos = (x)=>{ math.acos(Clamp(x, -1, +1)) };
Acos = (x)=>{ math.acos(Clamp(x, -1, +1)) };
Emil Ernerfeldt, lead developer
- emilk
- Posts: 616
- Joined: Mon Aug 31, 2009 11:01 am
- Location: Umeå, Sweden
Re: 1.8.0 sripted hinge disappear
emilk wrote:Clamp = (x, min, max) =>{ x < min ? min : x > max ? max : x };
Acos = (x)=>{ math.acos(Clamp(x, -1, +1)) };
sure. but my scenes already lags like hell
so i prefer just * 0.999999
Dream of Algodoo as game development engine...
-

Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
6 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 3 guests



