Changing Geom at Runtime (NaN Error)

Topics: Developer Forum, User Forum
Jun 25, 2008 at 2:12 PM
Edited Jun 25, 2008 at 6:05 PM
Free Image Hosting at

there is a way to change geometry position or inverting body orientation at runtime?

the image i put on top show my two characters of my game the small one is the principal the second is like a giraffe and the second need to change the side of the upper rectangle when it turn and move to left... the problem is that if i dont change the rectangle position when my main character attack (throwing small circles with radious 10) it works ok but if i change the rectangle position at runtime and start attacking i get the NaN error inside the Body.ApplyDrag()

i know it isnt good to change position of a body at runtime but i cant think in a diferent way to do this... if i dont change the positions everything works perfect

sry bad inglesh..

EDIT 01: The body of the hero and the enemy is made by a rectangle geom, a circle geom and a revolutejoint, the rectangle geom has momentofinertia set to positive infinite to prevent it from spinning. The hero body has a collision category that dont collide with it self but collide with ground and enemys and the enemy body dont collide with itself but collide with ground and hero

EDIT 02: I did some more tests with this senario and it seems that this NaN exeption can be triggered even if i dont move the geometries.. this error triggered again when i created the enemy with a circle with 50f radious with the rectangle (20f, 100f) on the left side (just invert the picture on top), then when i started shootting with the other character a 8.5f radious circle on the rectangle body of the enemy (the enemy is moving in the direction of my first character) it is pretty easy to throw the NaN exeption when the circle hit the rectangle but the strange thing is that when i test with other rectangles or shooting from the other side i cant throw this exeption...

I dunno if my explanation can show exactly my senario so there is two images to ilustrate what im doing the NaN exeption is triggered when the small circle hit the rectangle..

Free Image Hosting at
Free Image Hosting at

thxs again ^^
Jun 25, 2008 at 6:15 PM
Edited Jun 25, 2008 at 6:20 PM
For some reason this exeption is only triggered when the rectangle dimensions are (20f, 100f) if i change it to (22f, 100f) i can shoot as much as i want and in any direction and it dont thorw the exeption....

my guess: mabe this occur cause of the circle hitting the center of the rectangle..

i will try now changing the rectangle while the body change direction..

EDIT: bah.. with the new dimension it works great ^^ dunno why a diference from 20f to 22f in a rectangle can prevent such exeption on being throw..