Panda3D
 All Classes Functions Variables Enumerations
bulletPlaneShape.cxx
1 // Filename: bulletPlaneShape.cxx
2 // Created by: enn0x (23Jan10)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "bulletPlaneShape.h"
16 
17 TypeHandle BulletPlaneShape::_type_handle;
18 
19 ////////////////////////////////////////////////////////////////////
20 // Function: BulletPlaneShape::Constructor
21 // Access: Published
22 // Description:
23 ////////////////////////////////////////////////////////////////////
24 BulletPlaneShape::
25 BulletPlaneShape(const LVector3 &normal, PN_stdfloat constant) {
26 
27  btVector3 btNormal = LVecBase3_to_btVector3(normal);
28 
29  _shape = new btStaticPlaneShape(btNormal, constant);
30  _shape->setUserPointer(this);
31 }
32 
33 ////////////////////////////////////////////////////////////////////
34 // Function: BulletPlaneShape::ptr
35 // Access: Public
36 // Description:
37 ////////////////////////////////////////////////////////////////////
38 btCollisionShape *BulletPlaneShape::
39 ptr() const {
40 
41  return _shape;
42 }
43 
44 ////////////////////////////////////////////////////////////////////
45 // Function: BulletPlaneShape::make_from_solid
46 // Access: Public
47 // Description:
48 ////////////////////////////////////////////////////////////////////
49 BulletPlaneShape *BulletPlaneShape::
50 make_from_solid(const CollisionPlane *solid) {
51 
52  LVector3 normal = solid->get_normal();
53  PN_stdfloat constant = solid->dist_to_plane(LPoint3(0, 0, 0));
54 
55  return new BulletPlaneShape(normal, constant);
56 }
57 
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
Definition: lvector3.h:100
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85