Panda3D
linearVectorForce.h
1 // Filename: linearVectorForce.h
2 // Created by: charles (13Jun00)
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 #ifndef LINEARVECTORFORCE_H
16 #define LINEARVECTORFORCE_H
17 
18 #include "linearForce.h"
19 
20 ////////////////////////////////////////////////////////////////
21 // Class : LinearVectorForce
22 // Description : Simple directed vector force. Suitable for
23 // gravity, non-turbulent wind, etc...
24 ////////////////////////////////////////////////////////////////
25 class EXPCL_PANDAPHYSICS LinearVectorForce : public LinearForce {
26 PUBLISHED:
27  LinearVectorForce(const LVector3& vec, PN_stdfloat a = 1.0f, bool mass = false);
29  LinearVectorForce(PN_stdfloat x = 0.0f, PN_stdfloat y = 0.0f, PN_stdfloat z = 0.0f,
30  PN_stdfloat a = 1.0f, bool mass = false);
31  virtual ~LinearVectorForce();
32 
33  INLINE void set_vector(const LVector3& v);
34  INLINE void set_vector(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z);
35 
36  INLINE LVector3 get_local_vector() const;
37 
38  virtual void output(ostream &out) const;
39  virtual void write(ostream &out, unsigned int indent=0) const;
40 
41 public:
42  INLINE LinearVectorForce& operator += (const LinearVectorForce &other);
43 
44 private:
45  LVector3 _fvec;
46 
47  virtual LinearForce *make_copy();
48  virtual LVector3 get_child_vector(const PhysicsObject *po);
49 
50 public:
51  static TypeHandle get_class_type() {
52  return _type_handle;
53  }
54  static void init_type() {
55  LinearForce::init_type();
56  register_type(_type_handle, "LinearVectorForce",
57  LinearForce::get_class_type());
58  }
59  virtual TypeHandle get_type() const {
60  return get_class_type();
61  }
62  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
63 
64 private:
65  static TypeHandle _type_handle;
66 };
67 
68 #include "linearVectorForce.I"
69 
70 #endif // LINEARVECTORFORCE_H
Simple directed vector force.
A body on which physics will be applied.
Definition: physicsObject.h:29
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
Definition: lvector3.h:100
A force that acts on a PhysicsObject by way of an Integrator.
Definition: linearForce.h:25
virtual void write(ostream &out, unsigned int indent=0) const
Write a string representation of this instance to <out>.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
virtual void output(ostream &out) const
Write a string representation of this instance to <out>.
Definition: linearForce.cxx:97