- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
void* PhysicsWorld::CreateBodyImpl(const PhysicsBodyCInfo& bodyInfo)
{
void* pBody = 0;
PhysicsBody* body = 0;
switch(bodyInfo.GetType())
{
case PHYSICS_BODY:
pBody = new PhysicsKovahBody(this);
// This one is special and I dont know why. I used AddToWatch1 to get this std::string well casted.
body = (PhysicsBody*)(&(*(PhysicsKovahRigidBody*)(&*((PhysicsKovahBody*)pBody))));
pBody = body;
break;
case PHYSICS_CHARACTER_BODY:
pBody = new PhysicsKovahCharacterBody(this);
body = (PhysicsBody*)((PhysicsCharacterBody*)pBody);
break;
case PHYSICS_CAR_BODY:
pBody = new PhysicsKovahCarBody(this);
body = (PhysicsBody*)((PhysicsCarBody*)pBody);
break;
case PHYSICS_MOTO_BODY:
pBody = new PhysicsKovahMotoBody(this);
body = (PhysicsBody*)((PhysicsMotoBody*)pBody);
break;
case PHYSICS_BOAT_BODY:
pBody = new PhysicsKovahBoatBody(this);
body = (PhysicsBody*)((PhysicsBoatBody*)pBody);
break;
case PHYSICS_AIRPLANE_BODY:
pBody = new PhysicsKovahAirplaneBody(this);
body = (PhysicsBody*)(&(*(PhysicsVehicleBody*)(&(*(PhysicsAirplaneBody*)(&*((PhysicsKovahAirplaneBody*)pBody))))));
break;
case PHYSICS_HELICOPTER_BODY:
pBody = new PhysicsKovahHelicopterBody(this);
body = (PhysicsBody*)(&(*(PhysicsVehicleBody*)(&(*(PhysicsHelicopterBody*)(&*((PhysicsKovahHelicopterBody*)pBody))))));
break;
case PHYSICS_JETPACK_BODY:
pBody = new PhysicsKovahJetpackBody(this);
body = (PhysicsBody*)(&(*(PhysicsVehicleBody*)(&(*(PhysicsJetpackBody*)(&*((PhysicsKovahJetpackBody*)pBody))))));
break;
case PHYSICS_VTOL_BODY:
pBody = new PhysicsKovahVTOLBody(this);
body = (PhysicsBody*)(&(*(PhysicsVehicleBody*)(&(*(PhysicsVTOLBody*)(&*((PhysicsKovahVTOLBody*)pBody))))));
break;
case PHYSICS_CAMERA_BODY:
break;
};
if(body && body->Create(bodyInfo))
{
return pBody;
}
SafeDelete(body);
return 0;
}