00001 // Filename: linearSinkForce.cxx 00002 // Created by: charles (21Jun00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #include "linearSinkForce.h" 00020 00021 TypeHandle LinearSinkForce::_type_handle; 00022 00023 //////////////////////////////////////////////////////////////////// 00024 // Function : LinearSinkForce 00025 // Access : Public 00026 // Description : Simple constructor 00027 //////////////////////////////////////////////////////////////////// 00028 LinearSinkForce:: 00029 LinearSinkForce(const LPoint3f& p, FalloffType f, float r, float a, 00030 bool mass) : 00031 LinearDistanceForce(p, f, r, a, mass) { 00032 } 00033 00034 //////////////////////////////////////////////////////////////////// 00035 // Function : LinearSinkForce 00036 // Access : Public 00037 // Description : Simple constructor 00038 //////////////////////////////////////////////////////////////////// 00039 LinearSinkForce:: 00040 LinearSinkForce(void) : 00041 LinearDistanceForce(LPoint3f(0.0f, 0.0f, 0.0f), FT_ONE_OVER_R_SQUARED, 00042 1.0f, 1.0f, true) { 00043 } 00044 00045 //////////////////////////////////////////////////////////////////// 00046 // Function : LinearSinkForce 00047 // Access : Public 00048 // Description : copy constructor 00049 //////////////////////////////////////////////////////////////////// 00050 LinearSinkForce:: 00051 LinearSinkForce(const LinearSinkForce ©) : 00052 LinearDistanceForce(copy) { 00053 } 00054 00055 //////////////////////////////////////////////////////////////////// 00056 // Function : ~LinearSinkForce 00057 // Access : Public 00058 // Description : Simple destructor 00059 //////////////////////////////////////////////////////////////////// 00060 LinearSinkForce:: 00061 ~LinearSinkForce(void) { 00062 } 00063 00064 //////////////////////////////////////////////////////////////////// 00065 // Function : make_copy 00066 // Access : Public 00067 // Description : copier 00068 //////////////////////////////////////////////////////////////////// 00069 LinearForce *LinearSinkForce:: 00070 make_copy(void) { 00071 return new LinearSinkForce(*this); 00072 } 00073 00074 //////////////////////////////////////////////////////////////////// 00075 // Function : get_child_vector 00076 // Access : Public 00077 // Description : virtual force query 00078 //////////////////////////////////////////////////////////////////// 00079 LVector3f LinearSinkForce:: 00080 get_child_vector(const PhysicsObject *po) { 00081 return (get_force_center() - po->get_position()) * get_scalar_term(); 00082 }