/[hegemonie]/hegemonie/GameEngine/HgObject.m
ViewVC logotype

Diff of /hegemonie/GameEngine/HgObject.m

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.26 by nicov, Fri Aug 29 16:24:57 2003 UTC revision 1.27 by dam, Thu Sep 4 11:37:44 2003 UTC
# Line 76  Line 76 
76  - (void) _initDynamics  - (void) _initDynamics
77  {  {
78    MdlModel *model = [[self class] model];    MdlModel *model = [[self class] model];
79      dWorldID dWorld = [[self game] dWorld];
80      dSpaceID dSpace = [[self game] dSpace];
81      
82      NSAssert (dWorld && dSpace,
83                @"Internal inconsitency");
84    
85    _dBody = dBodyCreate ([[self game] dWorld]);    _dBody = dBodyCreate (dWorld);
86    
87  //   dTriMeshDataID dTriMeshData = dGeomTriMeshDataCreate ();  //   dTriMeshDataID dTriMeshData = dGeomTriMeshDataCreate ();
88  //   dGeomTriMeshDataBuildSimple (dTriMeshData,  //   dGeomTriMeshDataBuildSimple (dTriMeshData,
# Line 89  Line 94 
94  //                         NULL, NULL, NULL);  //                         NULL, NULL, NULL);
95        
96    bounding_box_t bbox = [model boundingBox: 0];    bounding_box_t bbox = [model boundingBox: 0];
97    _dGeom = dCreateBox ([[self game] dSpace],    _dGeom = dCreateBox (dSpace,
98                         bbox.max.x - bbox.min.x,                         bbox.max.x - bbox.min.x,
99                         bbox.max.y - bbox.min.y,                         bbox.max.y - bbox.min.y,
100                         bbox.max.z - bbox.min.z);                         bbox.max.z - bbox.min.z);
101    dGeomSetBody (_dGeom, _dBody);    dGeomSetBody (_dGeom, _dBody);
102    dSpaceAdd ([[self game] dSpace], _dGeom);    dSpaceAdd (dSpace, _dGeom);
103        
104  //   dBodySetAutoDisableSF1 (_dBody, YES);  //   dBodySetAutoDisableSF1 (_dBody, YES);
105  }  }
# Line 143  Line 148 
148    RELEASE(_game);    RELEASE(_game);
149    RELEASE(_player);    RELEASE(_player);
150    
151    dBodyDestroy (_dBody);    if (_dBody)
152    dSpaceRemove ([[self game] dSpace], _dGeom);      {
153    dGeomDestroy (_dGeom);        dSpaceID dSpace = [[self game] dSpace];
154    
155          NSAssert (_dGeom && dSpace,
156                    @"Internal inconsitency");
157          dBodyDestroy (_dBody);
158          dSpaceRemove (dSpace, _dGeom);
159          dGeomDestroy (_dGeom);
160        }
161    
162    [super dealloc];    [super dealloc];
163  }  }

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.27

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26