Panda3D
linearControlForce.cxx
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file linearControlForce.cxx
10  * @author Dave Schuyler
11  * @date 2006
12  */
13 
14 #include "datagram.h"
15 #include "datagramIterator.h"
16 #include "bamReader.h"
17 #include "bamWriter.h"
18 
19 #include "linearControlForce.h"
20 
21 TypeHandle LinearControlForce::_type_handle;
22 
23 /**
24  * Vector Constructor
25  */
27 LinearControlForce(const PhysicsObject *po, PN_stdfloat a, bool mass) :
28  LinearForce(a, mass),
29  _physics_object(po),
30  _fvec(0.0f, 0.0f, 0.0f) {
31 }
32 
33 /**
34  * Copy Constructor
35  */
38  LinearForce(copy) {
39  _physics_object = copy._physics_object;
40  _fvec = copy._fvec;
41 }
42 
43 /**
44  * Destructor
45  */
48 }
49 
50 /**
51  * copier
52  */
53 LinearForce *LinearControlForce::
54 make_copy() {
55  return new LinearControlForce(*this);
56 }
57 
58 /**
59  * vector access
60  */
61 LVector3 LinearControlForce::
62 get_child_vector(const PhysicsObject *po) {
63  if (_physics_object != nullptr && po == _physics_object) {
64  return _fvec;
65  } else {
66  return LVector3::zero();
67  }
68 }
69 
70 /**
71  * Write a string representation of this instance to <out>.
72  */
74 output(std::ostream &out) const {
75  #ifndef NDEBUG //[
76  out<<"LinearControlForce";
77  #endif //] NDEBUG
78 }
79 
80 /**
81  * Write a string representation of this instance to <out>.
82  */
84 write(std::ostream &out, int indent) const {
85  #ifndef NDEBUG //[
86  out.width(indent); out<<""; out<<"LinearControlForce:\n";
87  out.width(indent+2); out<<""; out<<"_fvec "<<_fvec<<"\n";
88  out.width(indent+2); out<<""; out<<"_physics_object "<<_physics_object<<"\n";
89  LinearForce::write(out, indent+2);
90  #endif //] NDEBUG
91 }
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
virtual ~LinearControlForce()
Destructor.
A body on which physics will be applied.
Definition: physicsObject.h:27
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A force that acts on a PhysicsObject by way of an Integrator.
Definition: linearForce.h:23
Simple directed vector force.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
Definition: indent.cxx:20
virtual void output(std::ostream &out) const
Write a string representation of this instance to <out>.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
LinearControlForce(const PhysicsObject *po=0, PN_stdfloat a=1.0f, bool mass=false)
Vector Constructor.
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
Definition: linearForce.cxx:95
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.