Panda3D
|
00001 // Filename: bulletPlaneShape.cxx 00002 // Created by: enn0x (23Jan10) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #include "bulletPlaneShape.h" 00016 00017 TypeHandle BulletPlaneShape::_type_handle; 00018 00019 //////////////////////////////////////////////////////////////////// 00020 // Function: BulletPlaneShape::Constructor 00021 // Access: Published 00022 // Description: 00023 //////////////////////////////////////////////////////////////////// 00024 BulletPlaneShape:: 00025 BulletPlaneShape(const LVector3 &normal, PN_stdfloat constant) { 00026 00027 btVector3 btNormal = LVecBase3_to_btVector3(normal); 00028 00029 _shape = new btStaticPlaneShape(btNormal, constant); 00030 _shape->setUserPointer(this); 00031 } 00032 00033 //////////////////////////////////////////////////////////////////// 00034 // Function: BulletPlaneShape::ptr 00035 // Access: Public 00036 // Description: 00037 //////////////////////////////////////////////////////////////////// 00038 btCollisionShape *BulletPlaneShape:: 00039 ptr() const { 00040 00041 return _shape; 00042 } 00043 00044 //////////////////////////////////////////////////////////////////// 00045 // Function: BulletPlaneShape::make_from_solid 00046 // Access: Public 00047 // Description: 00048 //////////////////////////////////////////////////////////////////// 00049 BulletPlaneShape *BulletPlaneShape:: 00050 make_from_solid(const CollisionPlane *solid) { 00051 00052 LVector3 normal = solid->get_normal(); 00053 PN_stdfloat constant = solid->dist_to_plane(LPoint3(0, 0, 0)); 00054 00055 return new BulletPlaneShape(normal, constant); 00056 } 00057