Project

General

Profile

SO3Engine
SO3SliderContraint.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OpenSpace3D
4For the latest info, see http://www.openspace3d.com
5
6Copyright (c) 2012 I-maginer
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU Lesser General Public License as published by the Free Software
10Foundation; either version 2 of the License, or (at your option) any later
11version.
12
13This program is distributed in the hope that it will be useful, but WITHOUT
14ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along with
18this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20http://www.gnu.org/copyleft/lesser.txt
21
22-----------------------------------------------------------------------------
23*/
24
32#ifndef __SO3SLIDERCONTRAINT_H__
33#define __SO3SLIDERCONTRAINT_H__
34
37#include "SO3Body.h"
38
39namespace SO3
40{
41
43{
44public:
45protected:
46private:
47 Ogre::Vector3 mPosition;
48 Ogre::Vector3 mPin;
49 bool mUseLimits;
50 bool mUseMotor;
51 bool mUseSpring;
52
53public:
56 SSliderContraint(SScene* scene, SBody* son, SBody* parent = 0, Ogre::Vector3 position = Ogre::Vector3::ZERO, Ogre::Vector3 pin = Ogre::Vector3::ZERO, bool useLimits = false, bool useSpring = false);
57
61
64 virtual void SetParentBody(SBody* body);
65
68 virtual void SetSonBody(SBody* body);
69
72 void SetLimits(Ogre::Real maxDist, Ogre::Real minDist);
73
76 void UseLimits(bool state);
77
80 void UseMotor(bool state);
81
84 void SetMotorVelocity(Ogre::Real velocity, Ogre::Real strength);
85
88 void SetSpring(Ogre::Real springStrength, Ogre::Real springDamping);
89
92 void UseSpring(bool state);
93
96 Ogre::Real GetVelocity();
97
100 Ogre::Vector3 GetForce();
101
104 Ogre::Real GetDistance();
105
108 void SetFriction(Ogre::Real friction);
109
110protected:
111private:
113 void UpdateJoint();
114};
115
116}
117
118#endif
librairies include
void SetSpring(Ogre::Real springStrength, Ogre::Real springDamping)
virtual void SetSonBody(SBody *body)
void SetLimits(Ogre::Real maxDist, Ogre::Real minDist)
void SetMotorVelocity(Ogre::Real velocity, Ogre::Real strength)
virtual void SetParentBody(SBody *body)
void SetFriction(Ogre::Real friction)