Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
Generic6DoFConstraint.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using SiliconStudio.Core.Mathematics;
4 
5 namespace SiliconStudio.Paradox.Physics
6 {
8  {
9  BulletSharp.Generic6DofConstraint mInternalGeneric6DofConstraint;
10  internal BulletSharp.Generic6DofConstraint InternalGeneric6DofConstraint
11  {
12  get
13  {
14  return mInternalGeneric6DofConstraint;
15  }
16  set
17  {
18  mInternalGeneric6DofConstraint = value;
19 
20  //fill translational motor
21  TranslationalLimitMotor = new TranslationalLimitMotor(mInternalGeneric6DofConstraint.TranslationalLimitMotor);
22 
23  //fill rotational motors
24  for (var i = 0; i < 3; i++)
25  {
26  RotationalLimitMotor[i] = new RotationalLimitMotor(mInternalGeneric6DofConstraint.GetRotationalLimitMotor(i));
27  }
28  }
29  }
30 
31  /// <summary>
32  /// Initializes a new instance of the <see cref="Generic6DoFConstraint"/> class.
33  /// </summary>
35  {
37  }
38 
39  /// <summary>
40  /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
41  /// </summary>
42  public override void Dispose()
43  {
44  if (InternalConstraint == null) return;
45 
46  for (var i = 0; i < 3; i++)
47  {
48  if (RotationalLimitMotor[i] == null) continue;
49  RotationalLimitMotor[i].Dispose();
50  RotationalLimitMotor[i] = null;
51  }
52 
53  if (TranslationalLimitMotor != null)
54  {
55  TranslationalLimitMotor.Dispose();
57  }
58 
59  base.Dispose();
60  }
61 
62  /// <summary>
63  /// Gets or sets the angular lower limit.
64  /// </summary>
65  /// <value>
66  /// The angular lower limit.
67  /// </value>
68  public Vector3 AngularLowerLimit
69  {
70  get { return InternalGeneric6DofConstraint.AngularLowerLimit; }
71  set { InternalGeneric6DofConstraint.AngularLowerLimit = value; }
72  }
73 
74  /// <summary>
75  /// Gets or sets the angular upper limit.
76  /// </summary>
77  /// <value>
78  /// The angular upper limit.
79  /// </value>
80  public Vector3 AngularUpperLimit
81  {
82  get { return InternalGeneric6DofConstraint.AngularUpperLimit; }
83  set { InternalGeneric6DofConstraint.AngularUpperLimit = value; }
84  }
85 
86  /// <summary>
87  /// Gets or sets the linear lower limit.
88  /// </summary>
89  /// <value>
90  /// The linear lower limit.
91  /// </value>
92  public Vector3 LinearLowerLimit
93  {
94  get { return InternalGeneric6DofConstraint.LinearLowerLimit; }
95  set { InternalGeneric6DofConstraint.LinearLowerLimit = value; }
96  }
97 
98  /// <summary>
99  /// Gets or sets the linear upper limit.
100  /// </summary>
101  /// <value>
102  /// The linear upper limit.
103  /// </value>
104  public Vector3 LinearUpperLimit
105  {
106  get { return InternalGeneric6DofConstraint.LinearUpperLimit; }
107  set { InternalGeneric6DofConstraint.LinearUpperLimit = value; }
108  }
109 
110  /// <summary>
111  /// Sets the frames.
112  /// </summary>
113  /// <param name="frameA">The frame a.</param>
114  /// <param name="frameB">The frame b.</param>
115  public void SetFrames(Matrix frameA, Matrix frameB)
116  {
117  InternalGeneric6DofConstraint.SetFrames(frameA, frameB);
118  }
119 
120  /// <summary>
121  /// Sets the limit.
122  /// </summary>
123  /// <param name="axis">The axis.</param>
124  /// <param name="lo">The lo.</param>
125  /// <param name="hi">The hi.</param>
126  public void SetLimit(int axis, float lo, float hi)
127  {
128  InternalGeneric6DofConstraint.SetLimit(axis, lo, hi);
129  }
130 
131  /// <summary>
132  /// Gets the translational limit motor.
133  /// </summary>
134  /// <value>
135  /// The translational limit motor.
136  /// </value>
138 
139  /// <summary>
140  /// Gets the rotational limit motor.
141  /// </summary>
142  /// <value>
143  /// The rotational limit motor.
144  /// </value>
145  public RotationalLimitMotor[] RotationalLimitMotor { get; private set; }
146  }
147 }
Generic6DoFConstraint()
Initializes a new instance of the Generic6DoFConstraint class.
Represents a three dimensional mathematical vector.
Definition: Vector3.cs:42
using SiliconStudio.Paradox. Physics
void SetLimit(int axis, float lo, float hi)
Sets the limit.
override void Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resourc...
void SetFrames(Matrix frameA, Matrix frameB)
Sets the frames.
Represents a 4x4 mathematical matrix.
Definition: Matrix.cs:47