Jump to content
Sign in to follow this  
[aps]gnat

1.#QNAN location error

Recommended Posts

I've discovered that its possible to end up in a location in OFP with the coordinates of;

[1.#QNAN, 1.#QNAN, 1.#QNAN]

WTF you may say, but QNAN is apparently "Not Quite A Number" .... in several programming languages.

So whats at this location?

BLACKNESS and the sea (you can hear it)! Oh, and a couple of unseen vehicles/buildings/something too because there is nothing you can do except twiddle with the action menu on stuff like "Open Door" !!! crazy_o.gif

Seems no one has reported this error before, probably because its hard to recreate. I can send myself into the Blackness onboard my ships. Its related to the Anti-Slam script that tries to stop ships bouncing stupid distances when hit by missiles etc.

The script is a semi-slow loop that checks the vehicles speed vector and if its too great it sets the ship back to the LAST ok velocity it recorded.

Now after a few minutes of deliberately slamming the ship around (usually sideways) I can send myself into this place of BLACKNESS and by using a radio trigger I can report the 3D location as above sad_o.gif

I can force myself back into the "real" map with a SETPOS command, but then I usually die on the spot ................... weirdness.

Still experimenting to see what this realm contains and whether other vehicles can be made to do the same.

Share this post


Link to post
Share on other sites

That's funny!

The problems you have with that weird position is, that the comparison with NaN will be always false (at least that's what I think...). Now imagine that many conditions will be now always false or true, and thus you get the actions, as the propagated NaN will render radius checks useless.

Now, you should look for code that (probably) divides through zero.

Share this post


Link to post
Share on other sites
Now, you should look for code that (probably) divides through zero.

No, I think I know what it is ....... ever noticed that boats when pushed end on into the water bounce out of the water very strongly ...... well I think the enviroment calcs done by the OFP engine is sending the vehicle at a super-vector through to "no-where". It seems to be amplified by me using a setvelocity[0,0,0] .... weird, you'd think that would stop it.

I found the reason I die, because it must be classed as underwater I think ..... if I setpos myself out of there quickly Im alive.

Interesting I CAN'T recover the vehicle ..... worse still is if I try to delete the vehicle, the frame rate drops to less than 1 for forever it seems.

Still playing .....

Share this post


Link to post
Share on other sites
Gnat @ Sep. 14 2006,01:48)]
Now, you should look for code that (probably) divides through zero.

No, I think I know what it is ....... ever noticed that boats when pushed end on into the water bounce out of the water very strongly ...... well I think the enviroment calcs done by the OFP engine is sending the vehicle at a super-vector through to "no-where". It seems to be amplified by me using a setvelocity[0,0,0] .... weird, you'd think that would stop it.

Perhaps you should post your code nevertheless smile_o.gif

Quote[/b] ]

I found the reason I die, because it must be classed as underwater I think ..... if I setpos myself out of there quickly Im alive.

Interesting I CAN'T recover the vehicle ..... worse still is if I try to delete the vehicle, the frame rate drops to less than 1 for forever it seems.

Still playing .....

I guess the reason why you die is because you have a very high velocity when being in that special "space".

Try to set your velocity to 0,0,0 before setPos'ing, I guess that the gravity force is still working there, but you don't notice it because "NaN + anything = NaN".

Share this post


Link to post
Share on other sites

Well, its nothing to do with scripting it seems vektorboson, but you need scripting or super-missiles to actually get it to occur.

Its related to Memory points and GEO Lod structure being present below the waterline.

If you have a boat like this and you SETVELOCITY a very high number sideways on the ship, or hit the ship on the side with a powerful missile, 8/10 times you will loose the ship to the Blackness (and the frame rate takes a hit).

No, BIS boats won't do it, mainly because they have very little GEO below the waterline and no memory points below.

BTW, theres 2 ways to make a boat float;

1) No Landcontact LOD and use the GEO Lod to actually contact/float on the water. (but boat with "lift" at speed)

2) Use Landcontact LOD points and the GEO lod will be ignored for "float" purposes.

I'm now modifying the Frigates to avoid the problem.

Share this post


Link to post
Share on other sites

Removed the problem from the AI manned boats, but as soon as I board a boat and do the same test it fails sad_o.gif  weirdness

..... any way to test for the position text of "1.#QNAN" in a script line you think ..... ?

Share this post


Link to post
Share on other sites

How about:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

format["%1", getpos _boat] == "[1.#QNAN,1.#QNAN,1.#QNAN]"

or you can just operate on one component:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

format["%1", getpos _boat select 0] == "1.#QNAN"

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×