Panda3D

Loading...
Searching...
No Matches
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 */
26 LinearControlForce::
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 */
36 LinearControlForce::
37 LinearControlForce(const LinearControlForce &copy) :
38 LinearForce(copy) {
39 _physics_object = copy._physics_object;
40 _fvec = copy._fvec;
41}
42
43/**
44 * Destructor
45 */
46 LinearControlForce::
47~LinearControlForce() {
48}
49
50/**
51 * copier
52 */
53 LinearForce *LinearControlForce::
54make_copy() {
55 return new LinearControlForce(*this);
56}
57
58/**
59 * vector access
60 */
61LVector3 LinearControlForce::
62get_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 */
73 void LinearControlForce::
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 */
83 void LinearControlForce::
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}
bamReader.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bamWriter.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
LinearControlForce::write
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
Definition linearControlForce.cxx:84
LinearControlForce::LinearControlForce
LinearControlForce(const PhysicsObject *po=0, PN_stdfloat a=1.0f, bool mass=false)
Vector Constructor.
Definition linearControlForce.cxx:27
LinearControlForce::~LinearControlForce
virtual ~LinearControlForce()
Destructor.
Definition linearControlForce.cxx:47
LinearControlForce::output
virtual void output(std::ostream &out) const
Write a string representation of this instance to <out>.
Definition linearControlForce.cxx:74
LinearForce
A force that acts on a PhysicsObject by way of an Integrator.
Definition linearForce.h:23
LinearForce::write
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
Definition linearForce.cxx:95
PhysicsObject
A body on which physics will be applied.
Definition physicsObject.h:27
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
datagramIterator.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
datagram.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
indent
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
Definition indent.cxx:20
linearControlForce.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.