~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to extern/bullet/BulletDynamics/Dynamics/ContactJoint.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Lukas Fittl
  • Date: 2006-09-20 01:57:27 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060920015727-gmoqlxwstx9wwqs3
Tags: 2.42a-1ubuntu1
* Merge from Debian unstable (Closes: Malone #55903). Remaining changes:
  - debian/genpot: Add python scripts from Lee June <blender@eyou.com> to
    generate a reasonable PO template from the sources. Since gettext is used
    in a highly nonstandard way, xgettext does not work for this job.
  - debian/rules: Call the scripts, generate po/blender.pot, and clean it up
    in the clean target.
  - Add a proper header to the generated PO template.
* debian/control: Build depend on libavformat-dev >= 3:0.cvs20060823-3.1,
  otherwise this package will FTBFS

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
Bullet Continuous Collision Detection and Physics Library
 
3
Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
 
4
 
 
5
This software is provided 'as-is', without any express or implied warranty.
 
6
In no event will the authors be held liable for any damages arising from the use of this software.
 
7
Permission is granted to anyone to use this software for any purpose, 
 
8
including commercial applications, and to alter it and redistribute it freely, 
 
9
subject to the following restrictions:
 
10
 
 
11
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
 
12
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
 
13
3. This notice may not be removed or altered from any source distribution.
 
14
*/
1
15
#include "ContactJoint.h"
2
16
#include "RigidBody.h"
3
17
#include "NarrowPhaseCollision/PersistentManifold.h"
88
102
        normal[3] = 0;  // @@@ hmmm
89
103
        
90
104
        //      if (GetBody0())
91
 
        SimdVector3 ccc1;
 
105
        SimdVector3 relativePositionA;
92
106
        {
93
 
                ccc1 = point.GetPositionWorldOnA() - m_body0->getCenterOfMassPosition();
 
107
                relativePositionA = point.GetPositionWorldOnA() - m_body0->getCenterOfMassPosition();
94
108
                dVector3 c1;
95
 
                c1[0] = ccc1[0];
96
 
                c1[1] = ccc1[1];
97
 
                c1[2] = ccc1[2];
 
109
                c1[0] = relativePositionA[0];
 
110
                c1[1] = relativePositionA[1];
 
111
                c1[2] = relativePositionA[2];
98
112
                
99
113
                // set jacobian for normal
100
114
                info->J1l[0] = normal[0];
104
118
                
105
119
        }
106
120
        //              if (GetBody1())
107
 
        SimdVector3 ccc2;
 
121
        SimdVector3 relativePositionB;
108
122
        {
109
123
                dVector3 c2;
110
 
                ccc2 = point.GetPositionWorldOnB() - m_body1->getCenterOfMassPosition();
 
124
                relativePositionB = point.GetPositionWorldOnB() - m_body1->getCenterOfMassPosition();
111
125
                
112
126
                //                      for (i=0; i<3; i++) c2[i] = j->contact.geom.pos[i] -
113
127
                //                                        j->node[1].body->pos[i];
114
 
                c2[0] = ccc2[0];
115
 
                c2[1] = ccc2[1];
116
 
                c2[2] = ccc2[2];
 
128
                c2[0] = relativePositionB[0];
 
129
                c2[1] = relativePositionB[1];
 
130
                c2[2] = relativePositionB[2];
117
131
                
118
132
                info->J2l[0] = -normal[0];
119
133
                info->J2l[1] = -normal[1];
128
142
//              depth = 0.f;
129
143
        
130
144
        info->c[0] = k * depth;
131
 
        float maxvel = .2f;
 
145
        //float maxvel = .2f;
132
146
 
133
147
//      if (info->c[0] > maxvel)
134
148
//              info->c[0] = maxvel;
155
169
        dVector3 t1,t2; // two vectors tangential to normal
156
170
        
157
171
        dVector3 c1;
158
 
        c1[0] = ccc1[0];
159
 
        c1[1] = ccc1[1];
160
 
        c1[2] = ccc1[2];
 
172
        c1[0] = relativePositionA[0];
 
173
        c1[1] = relativePositionA[1];
 
174
        c1[2] = relativePositionA[2];
161
175
        
162
176
        dVector3 c2;
163
 
        c2[0] = ccc2[0];
164
 
        c2[1] = ccc2[1];
165
 
        c2[2] = ccc2[2];
 
177
        c2[0] = relativePositionB[0];
 
178
        c2[1] = relativePositionB[1];
 
179
        c2[2] = relativePositionB[2];
166
180
        
167
181
        
168
182
        float friction = FRICTION_CONSTANT*m_body0->getFriction() * m_body1->getFriction();