/* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. ### File Specific: main-programmer: Adrian Buerli */ #include #include "IPhys.h" #include "stdincl.h" using namespace std; IPhys::IPhys () { } IPhys::~IPhys () { } // Simulation void IPhys::simIterate(Uint32 deltaT){ Vector Accel; switch (behav) { case B_MASS_POINT: Accel = resForce / m; vel = vel + (Accel * deltaT); pos = pos + (vel * deltaT); break; case B_RIGID_BODY: break; case B_ELAST_BODY: break; case I_SPRING_LINEAR: break; case I_DMPSPR_LINEAR: break; case I_SPRING_MOMENTUM: break; case I_DMPSPR_MOMENTUM: break; case F_GRAVITY: break; case F_HOVER: break; case F_SHOCKWAVE: break; case F_BEAM: break; default:; } resForce = Vector(0,0,0); }; // Exertion of external forces void IPhys::exertForce( Vector force ){ resForce = resForce + force; }; void IPhys::exertMomentum( Vector Momentum ){ resMomentum = resMomentum + Momentum; }; // set attributes void IPhys::setBehaviour( IPHYS_BEHAVIOUR desiredBehaviour ){ behav = desiredBehaviour; }; void IPhys::setBody( float mass ){ m = mass; }; void IPhys::setBody( float mass, float inertMoment[] ){ m = mass; //inertM = inertMoment; }; void IPhys::setBody( float mass, float inertMoment[], float YoungsModulus ){ m = mass; //inertM = inertMoment; YE = YoungsModulus; }; void IPhys::setMounts( WorldEntity *point1, WorldEntity *point2 ){ mounts[0] = point1; mounts[1] = point2; }; void IPhys::setSpring( float neutralLength, float springConst ){ spNeutralL = neutralLength; spConst = springConst; }; void IPhys::setSpring( float neutralLength, float springConst, float damping ){ spNeutralL = neutralLength; spConst = springConst; dmp = damping; }; void IPhys::setSpring( Quaternion neutralOrientation, float springConst ){ mspNeutralOri = neutralOrientation; spConst = springConst; }; void IPhys::setSpring( Quaternion neutralOrientation, float springConst, float damping ){ mspNeutralOri = neutralOrientation; spConst = springConst; dmp = damping; };