Panda3D
Loading...
Searching...
No Matches
bulletSoftBodyControl.cxx
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file bulletSoftBodyControl.cxx
10 * @author enn0x
11 * @date 2010-03-04
12 */
13
15
16/**
17 *
18 */
19BulletSoftBodyControl::
20BulletSoftBodyControl() {
21
22 _goal = 0.0;
23 _maxtorque = 0.0;
24
25 _angle = 0.0;
26 _sign = 0.0;
27}
28
29/**
30 *
31 */
32BulletSoftBodyControl::
33~BulletSoftBodyControl() {
34
35}
36
37/**
38 *
39 */
40void BulletSoftBodyControl::
41Prepare(btSoftBody::AJoint* joint) {
42
43 if (btFabs(_sign) > 0.0) {
44 joint->m_refs[0][0] = btCos(_angle * _sign);
45 joint->m_refs[0][2] = btSin(_angle * _sign);
46 }
47}
48
49/**
50 *
51 */
52btScalar BulletSoftBodyControl::
53Speed(btSoftBody::AJoint *, btScalar current) {
54
55 return (current + btMin(_maxtorque, btMax(-_maxtorque, _goal - current)));
56}
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.