00001 /* 00002 SagaEngine library 00003 Copyright (c) 2002-2006 Skalden Studio AS 00004 00005 This software is provided 'as-is', without any express or implied 00006 warranty. In no event will the authors be held liable for any 00007 damages arising from the use of this software. 00008 00009 Permission is granted to distribute the library under the terms of the 00010 Q Public License version 1.0. Be sure to read and understand the license 00011 before using the library. It should be included here, or you may read it 00012 at http://www.trolltech.com/products/qt/licenses/licensing/qpl 00013 00014 The original version of this library can be located at: 00015 http://www.sagaengine.com/ 00016 00017 Rune Myrland 00018 rune@skalden.com 00019 */ 00020 00021 00022 #include "Move.hpp" 00023 00024 #ifndef SE_OWN_MOVE 00025 00026 #include "util/type/util_type.hpp" 00027 #include "util/math/Trig.hpp" 00028 #include "util/vecmath/ViewPoint.hpp" 00029 #include "../stat/all.hpp" 00030 #include "../area/Area.hpp" 00031 00032 namespace se_core { 00033 00034 Move 00035 ::Move() : velocity_(0, 0, 0), mass_(SCALE_RES) 00036 , linearFriction_(.25f * SCALE_STEP), linearFrictionR_(0), angularFriction_(.25f * SCALE_STEP) 00037 , didBounce_(false), bounceMaintain_(.33f), floorBounce_(.5f), affectCode_(0) { 00038 angularVelocity_.setIdentity(); 00039 torque_.setIdentity(); 00040 force_.reset(); 00041 work_.speed_ = 0; 00042 work_.vp_.setIdentity(); 00043 } 00044 00045 00046 void Move 00047 ::setMove(const Move& original) { 00048 force_ = original.force_; 00049 velocity_ = original.velocity_; 00050 } 00051 00052 00053 void Move 00054 ::changeSpeed(coor_t speed) { 00055 work_.speed_ = speed; 00056 velocity_.setForward(work_.speed_, work_.vp_.face_.yaw_, 0); 00057 } 00058 00059 00060 void Move 00061 ::changeYaw(bray_t yaw) { 00062 work_.vp_.face_.yaw_ = yaw; 00063 velocity_.setForward(work_.speed_, work_.vp_.face_.yaw_, 0); 00064 } 00065 00066 00067 void Move 00068 ::changeMovement(bray_t yaw, coor_t speed) { 00069 work_.vp_.face_.yaw_ = yaw; 00070 work_.speed_ = speed; 00071 velocity_.setForward(work_.speed_, work_.vp_.face_.yaw_, 0); 00072 } 00073 00074 00075 void Move 00076 ::resetForces() { 00077 // Forces must be reapplied every step 00078 force_.reset(); 00079 torque_.reset(); 00080 didBounce_ = false; 00081 } 00082 00083 00084 } 00085 00086 #endif // SE_OWN_MOVE
Home Page | SagaEngine trunk (updated nightly) reference generated Sun Dec 2 20:06:11 2007 by Doxygen version 1.3.9.1.