Author Topic: Odd bug with Physics.cpp  (Read 1918 times)

0 Members and 1 Guest are viewing this topic.

Offline RazorsKiss

  • 28
  • The Cutting Edge
    • RazorsKiss.net
Odd bug with Physics.cpp
Quote
Assert: is_valid_vec(&pi->rotvel)
File: J:\src\cvs\fs2_open_3_6_9.final\code\Physics\Physics.cpp
Line: 562
{This filename points to the location of a file on the computer that built this executable}

Call Stack:
-------------------------
  physics_sim()  obj_move_call_physics() obj_move_all() game_simulation_frame() game_frame() game_do_frame() game_do_state() gameseq_process_events() game_main() WinMain() WinMainCTStartup() kernel32.dll 7c816fd7()

This was with 3_6_9 standard, not debug, so I don't have a spew for it.  It poitns to, it looks like, this block of code:

Code: [Select]
Assert(is_valid_vec(&new_vel));

pi->rotvel = new_vel;

tangles.p = pi->rotvel.xyz.x*sim_time;
tangles.h = pi->rotvel.xyz.y*sim_time;
tangles.b = pi->rotvel.xyz.z*sim_time;

// If this is the viewer_object, keep track of the
// changes in banking so that rotated bitmaps look correct.
// This is used by the g3_draw_rotated_bitmap function.
if ( pi == Viewer_physics_info ) {
switch(Physics_viewer_direction){
case PHYSICS_VIEWER_FRONT:
Physics_viewer_bank -= tangles.b;
break;

case PHYSICS_VIEWER_UP:
Physics_viewer_bank -= tangles.h;
break;

case PHYSICS_VIEWER_REAR:
Physics_viewer_bank += tangles.b;
break;

case PHYSICS_VIEWER_LEFT:
Physics_viewer_bank += tangles.p;
break;

case PHYSICS_VIEWER_RIGHT:
Physics_viewer_bank -= tangles.p;
break;

default:
Physics_viewer_bank -= tangles.b;
break;
}

if ( Physics_viewer_bank < 0.0f ){
Physics_viewer_bank += 2.0f * PI;
}

if ( Physics_viewer_bank > 2.0f * PI ){
Physics_viewer_bank -= 2.0f * PI;
}
}

Any pointers on what it's trying to tell me?  (and feel free to ask any questions you like)
Fringespace - Tachyon: Revived   ModDB Listing   Razorskiss.net 

You only think you can outfly me.

 

Offline Turey

  • Installer dude
  • 211
  • The diminutive form of Turambar.
    • FreeSpace Open Installer Homepage
Re: Odd bug with Physics.cpp
I've actually gotten this one, but it was serveral months ago and I don't remember how I fixed it.

I do recall that it tended to happen when a certain ship died.
Creator of the FreeSpace Open Installer.
"Calm. The ****. Down." -Taristin
why would an SCP error be considered as news? :wtf: *smacks Cobra*It's a feature.

 

Offline RazorsKiss

  • 28
  • The Cutting Edge
    • RazorsKiss.net
Re: Odd bug with Physics.cpp
Yes, it is a particular ship dying - our "Manta". 
Fringespace - Tachyon: Revived   ModDB Listing   Razorskiss.net 

You only think you can outfly me.

 

Offline Turey

  • Installer dude
  • 211
  • The diminutive form of Turambar.
    • FreeSpace Open Installer Homepage
Re: Odd bug with Physics.cpp
I think I remember a work-around for this... but I'm not sure.

What I did was I got the ship completely set up through Max->pof. Then, I took just the hull and ran it Max->3ds->cob->pof.

Then, I did a global data import from the first one into the second one. Then, the second one worked fine.

I don't know if this will work for you, or even if this is the best way to fix it. It worked for me, and I didn't take the time to look for a better way of doing it.


NOTE: This entire post is based on my memories of the model conversion I did several months ago. As such, take anything in it with a grain of salt. If BtRL decides they want me as a model converter, then I'll be able to help you better.
Creator of the FreeSpace Open Installer.
"Calm. The ****. Down." -Taristin
why would an SCP error be considered as news? :wtf: *smacks Cobra*It's a feature.

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Re: Odd bug with Physics.cpp
my guess is that something is a zero that shouldn't be.
I'm thinking radius, but I don't have anything concrete to base that off of.

if that is a release build then it should not be throwing assertions.
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Taristin

  • Snipes
  • 213
  • BlueScalie
    • Skelkwank Shipyards
Re: Odd bug with Physics.cpp
The max converter creates unstable shield meshes for one reason or another...... from what ive read.
Freelance Modeler | Amateur Artist

 

Offline taylor

  • Super SCP/Linux Guru
  • 212
    • http://www.icculus.org/~taylor
Re: Odd bug with Physics.cpp
Is_valid_vec() checks for NaN values.  The most likely cause of this error is from some invalid model data.  I've seen it numerous times when one or more of the MOI values for the model is NaN.  If even one value is NaN, and it gets through the loading code, it will propagate to all other parts of the relavant code and create other NaN values.

So just verify in ModelView32 or something that none of the values that you can find are something like "-nan(0x??????)".  If you find one, change it to a proper value (or just 0.0) and see if that fixes it in-game.

 

Offline RazorsKiss

  • 28
  • The Cutting Edge
    • RazorsKiss.net
Re: Odd bug with Physics.cpp
"-1.#QNAN000000000000000" was the MOI in question.  You were absolutely right. 

taylor = the bomb :D

Thanks folks.
Fringespace - Tachyon: Revived   ModDB Listing   Razorskiss.net 

You only think you can outfly me.

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Re: Odd bug with Physics.cpp
BTW MOI is a matrix so if you are going to give it a default value, all zeros is NOT the best idea, a diagnal of 1s I think would be best from upper left to lower right.
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline RazorsKiss

  • 28
  • The Cutting Edge
    • RazorsKiss.net
Re: Odd bug with Physics.cpp
BTW MOI is a matrix so if you are going to give it a default value, all zeros is NOT the best idea, a diagnal of 1s I think would be best from upper left to lower right.

So, say...

1.000... | 0.000... | 0.000...
0.000... | 1.000... | 0.000...
0.000... | 0.000... | 1.000...

?


Fringespace - Tachyon: Revived   ModDB Listing   Razorskiss.net 

You only think you can outfly me.

 

Offline Trivial Psychic

  • 212
  • Snoop Junkie
Re: Odd bug with Physics.cpp
Any particular reason for this?
The Trivial Psychic Strikes Again!

 

Offline Turey

  • Installer dude
  • 211
  • The diminutive form of Turambar.
    • FreeSpace Open Installer Homepage
Re: Odd bug with Physics.cpp
Any particular reason for this?

It's just the way matrix math works.
Creator of the FreeSpace Open Installer.
"Calm. The ****. Down." -Taristin
why would an SCP error be considered as news? :wtf: *smacks Cobra*It's a feature.

 

Offline Trivial Psychic

  • 212
  • Snoop Junkie
Re: Odd bug with Physics.cpp
What I mean is, why shouldn't I use all zeros, and what advantages will using this diagonal 1 thing get me?
The Trivial Psychic Strikes Again!

 

Offline CP5670

  • Dr. Evil
  • Global Moderator
  • 212
Re: Odd bug with Physics.cpp
Actually, all zeros is probably the safest option unless it's a fighter. The MOI controls the rotational component of the knockback effect from weapons and making it zero will prevent the ship from spinning when hit (although it can still move).

  

Offline RazorsKiss

  • 28
  • The Cutting Edge
    • RazorsKiss.net
Re: Odd bug with Physics.cpp
All my so-far-modded ships are fighters, so, yeah :D
Fringespace - Tachyon: Revived   ModDB Listing   Razorskiss.net 

You only think you can outfly me.