FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Bug exporting object bounds?

2 posters

Go down

Bug exporting object bounds? Empty Bug exporting object bounds?

Post  gtmacdonald Mon Jan 12, 2009 12:10 am

Hello,

I think I've found an issue with exporting the object bounds type. I noticed my static objects were coming in as a trimesh even though I specified a sphere or cube. Then I noticed that my ridged body objects didn't have a bounds tag in the sio2 file. So I tweaked the exporter:

Here's the original code:

Code:

            #====================================
            # OBJECT BOUNDS
            #
            # 0 - Cube
            # 1 - Sphere
            # 2 - Cylinder
            # 3 - Cone
            # 4 - Static Triangle Mesh
            # 5 - Convex Hull Polytope
            #
            #====================================         
            if( obj.rbFlags & Object.RBFlags[ "ACTOR"  ] and
                  obj.rbFlags & Object.RBFlags[ "DYNAMIC" ] ):

               bounds = obj.rbShapeBoundType

               
               if( obj.rbFlags & Object.RBFlags["RIGIDBODY"] and
                     bounds != 4 ):
                  mass = obj.rbMass


               if( obj.rbFlags & Object.RBFlags["SOFTBODY"] ):
                  
                  if( bounds != 4 or bounds != 5 ):
                     bounds = 4
                  
                  mass = obj.rbMass
                  
            
            if( bounds ):
               buffer = "\tbounds( %s )\n" % bounds
               f.write( buffer )

And here's the same bit with my changes:

Code:

            bounds  = None
                     
            if( obj.rbFlags & Object.RBFlags[ "ACTOR"  ] ):
               if( obj.rbFlags & Object.RBFlags[ "BOUNDS"  ] ):
                  bounds = obj.rbShapeBoundType
               else:
                  bounds = 4
                  
               if(obj.rbFlags & Object.RBFlags[ "DYNAMIC" ] ):
                  
                  if( obj.rbFlags & Object.RBFlags["RIGIDBODY"] and
                        bounds != 4 ):
                     mass = obj.rbMass
   
   
                  if( obj.rbFlags & Object.RBFlags["SOFTBODY"] ):
                     
                     if( bounds != 4 or bounds != 5 ):
                        bounds = 4
                     
                     mass = obj.rbMass
                     
            
            if( bounds is not None ):
               buffer = "\tbounds( %s )\n" % bounds
               f.write( buffer )

I also deleted bounds = 4 from a few comment blocks up.

I think the problem with the previous code was that "if(bounds)" wasn't setting bounds for cubes because if(0) is a no-op. I looked around for where bounds was being initialized and the only place I found was during the sio2 file loading. I didn't find any defaults so this might cause something unexpected.

The other problem was that the bounds shape for my static objects wasn't being set.

Please let me know if what I did breaks something else.

Thanks. Smile

-Greg

gtmacdonald

Posts : 9
Join date : 2008-12-11

Back to top Go down

Bug exporting object bounds? Empty Re: Bug exporting object bounds?

Post  sio2interactive Mon Jan 12, 2009 2:17 am

Hummmmmm this is what I got into the exporter at the moment maybe a little bug slipped in...


Code:


            #====================================
            # OBJECT BOUNDS
            #
            # 0 - Cube
            # 1 - Sphere
            # 2 - Cylinder
            # 3 - Cone
            # 4 - Static Triangle Mesh
            # 5 - Convex Hull Polytope
            #
            #====================================         
            if( obj.rbFlags & Object.RBFlags[ "ACTOR"  ] and
                  obj.rbFlags & Object.RBFlags[ "DYNAMIC" ] ):

               bounds = obj.rbShapeBoundType

               if( obj.rbFlags & Object.RBFlags["RIGIDBODY"] or
                    obj.rbFlags & Object.RBFlags[ "DYNAMIC" ] and
                     bounds != 4 ):
                     
                     mass = obj.rbMass


               if( obj.rbFlags & Object.RBFlags["SOFTBODY"] ):
                  
                     mass = obj.rbMass
                     
                     if( bounds != 4 or bounds != 5 ):
                        bounds = 4

         
            if( bounds ):
               buffer = "\tbounds( %s )\n" % bounds
               f.write( buffer )


sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 44
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum