Panda3D
 All Classes Functions Variables Enumerations
linearControlForce.cxx
00001 // Filename: linearControlForce.cxx
00002 // Created by: Dave Schuyler (2006)
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 "datagram.h"
00016 #include "datagramIterator.h"
00017 #include "bamReader.h"
00018 #include "bamWriter.h"
00019 
00020 #include "linearControlForce.h"
00021 
00022 TypeHandle LinearControlForce::_type_handle;
00023 
00024 ////////////////////////////////////////////////////////////////////
00025 //     Function : LinearControlForce
00026 //       Access : Public
00027 //  Description : Vector Constructor
00028 ////////////////////////////////////////////////////////////////////
00029 LinearControlForce::
00030 LinearControlForce(const PhysicsObject *po, PN_stdfloat a, bool mass) :
00031   LinearForce(a, mass),
00032   _physics_object(po),
00033   _fvec(0.0f, 0.0f, 0.0f) {
00034 }
00035 
00036 ////////////////////////////////////////////////////////////////////
00037 //     Function : LinearControlForce
00038 //       Access : Public
00039 //  Description : Copy Constructor
00040 ////////////////////////////////////////////////////////////////////
00041 LinearControlForce::
00042 LinearControlForce(const LinearControlForce &copy) :
00043   LinearForce(copy) {
00044   _physics_object = copy._physics_object;
00045   _fvec = copy._fvec;
00046 }
00047 
00048 ////////////////////////////////////////////////////////////////////
00049 //     Function : LinearControlForce
00050 //       Access : Public
00051 //  Description : Destructor
00052 ////////////////////////////////////////////////////////////////////
00053 LinearControlForce::
00054 ~LinearControlForce() {
00055 }
00056 
00057 ////////////////////////////////////////////////////////////////////
00058 //    Function : make_copy
00059 //      Access : Public, virtual
00060 // Description : copier
00061 ////////////////////////////////////////////////////////////////////
00062 LinearForce *LinearControlForce::
00063 make_copy() {
00064   return new LinearControlForce(*this);
00065 }
00066 
00067 ////////////////////////////////////////////////////////////////////
00068 //    Function : get_child_vector
00069 //      Access : Public
00070 // Description : vector access
00071 ////////////////////////////////////////////////////////////////////
00072 LVector3 LinearControlForce::
00073 get_child_vector(const PhysicsObject *po) {
00074   if (_physics_object != 0 && po == _physics_object) {
00075     return _fvec;
00076   } else {
00077     return LVector3::zero();
00078   }
00079 }
00080 
00081 ////////////////////////////////////////////////////////////////////
00082 //     Function : output
00083 //       Access : Public
00084 //  Description : Write a string representation of this instance to
00085 //                <out>.
00086 ////////////////////////////////////////////////////////////////////
00087 void LinearControlForce::
00088 output(ostream &out) const {
00089   #ifndef NDEBUG //[
00090   out<<"LinearControlForce";
00091   #endif //] NDEBUG
00092 }
00093 
00094 ////////////////////////////////////////////////////////////////////
00095 //     Function : write
00096 //       Access : Public
00097 //  Description : Write a string representation of this instance to
00098 //                <out>.
00099 ////////////////////////////////////////////////////////////////////
00100 void LinearControlForce::
00101 write(ostream &out, unsigned int indent) const {
00102   #ifndef NDEBUG //[
00103   out.width(indent); out<<""; out<<"LinearControlForce:\n";
00104   out.width(indent+2); out<<""; out<<"_fvec "<<_fvec<<"\n";
00105   out.width(indent+2); out<<""; out<<"_physics_object "<<_physics_object<<"\n";
00106   LinearForce::write(out, indent+2);
00107   #endif //] NDEBUG
00108 }
 All Classes Functions Variables Enumerations