| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #pragma hdrstop
- #include "fOdeRagdollC.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma link "GLS.BaseClasses"
- #pragma link "GLS.BitmapFont"
- #pragma link "GLS.Cadencer"
- #pragma link "GLS.Coordinates"
- #pragma link "GLS.HUDObjects"
- #pragma link "GLS.Material"
- #pragma link "GLS.Objects"
- #pragma link "GLS.Scene"
- #pragma link "GLS.ShadowPlane"
- #pragma link "GLS.VectorFileObjects"
- #pragma link "GLS.SceneViewer"
- #pragma link "GLS.WindowsFont"
- #pragma link "GLS.Utils"
- #pragma resource "*.dfm"
- TfRagDoll *fRagDoll;
- //---------------------------------------------------------------------------
- __fastcall TfRagDoll::TfRagDoll(TComponent* Owner)
- : TForm(Owner)
- {
- }
- //---------------------------------------------------------------------------
- __fastcall TWorld_ODE::TWorld_ODE(TObject *AOwner)
- {
- TdMatrix3 R;
- ODEEnable = false;
- PhysTime = 0;
- //Create physic
- World = dWorldCreate();
- dWorldSetQuickStepNumIterations(World, 8);
- Space = dHashSpaceCreate(NULL);
- ///- contactgroup = &dJointGroupCreate(0);
- dWorldSetGravity (World, 0, 0, -0.81);
- dWorldSetCFM (World, 1e-5);
- //Floor
- dCreatePlane (Space, 0, 0, 1, 0);
- //Box wall limit
- dCreatePlane (Space, 0, 1, 0, -50.00);
- dCreatePlane (Space, 1, 0, 0, -50.00);
- dCreatePlane (Space, 0,-1, 0, -50.00);
- dCreatePlane (Space, -1, 0, 0, -50.00);
- // Create 1 GLSCube and a box space.
- Ground_box = dCreateBox(Space,25,50,50);
- dRFromAxisAndAngle (R,0,1,0,0.95);
- dGeomSetPosition(Ground_box,32,5,0.5);
- dGeomSetRotation(Ground_box,R);
- Cube = (TGLCube*)(fRagDoll->ODEScene->AddNewChild(__classid(TGLCube)));
- PdxGeom(Ground_box)->data = Cube;
- CopyCubeSizeFromBox(Cube, Ground_box);
- PositionSceneObject((TGLBaseSceneObject*)(PdxGeom(Ground_box)->data), Ground_box);
- // Same Create 1 GLSCube and a box space.
- Ground_box2 = dCreateBox (Space,5,10,5);
- dRFromAxisAndAngle (R,0,1,0,0);
- dGeomSetPosition (Ground_box2,-12,-5,2.5);
- dGeomSetRotation (Ground_box2,R);
- Cube2 = (TGLCube*)(fRagDoll->ODEScene->AddNewChild(__classid(TGLCube)));
- PdxGeom(Ground_box2)->data = Cube2;
- CopyCubeSizeFromBox(Cube2, Ground_box2);
- PositionSceneObject((TGLBaseSceneObject*)(PdxGeom(Ground_box2)->data), Ground_box2);
- // Create now a sphere
- Ground_box2 = dCreateSphere (Space,5);
- dGeomSetPosition (Ground_box2,0,-15,2.5);
- PdxGeom(Ground_box2)->data = (TGLSphere*)(fRagDoll->ODEScene->AddNewChild(__classid(TGLSphere)));
- ///- (TGLSphere*)(PdxGeom(Ground_box2)->data)->Radius = 5;
- PositionSceneObject((TGLSphere*)(PdxGeom(Ground_box2)->data), Ground_box2);
- }
- void __fastcall TfRagDoll::FormCreate(TObject *Sender)
- {
- TFileName Path = GetCurrentAssetPath();
- SetCurrentDir(Path + "\\modelext");
- //
- }
- //---------------------------------------------------------------------------
|