Model standing up after falling
Posted: Fri Nov 01, 2013 2:01 pm
My physic object stand up after falling. Don't know how to fix it.
I'm used simple example for create boundObject from Mesh:
and My Update Method is :
Aaaand the object makes the following items :
I'm used simple example for create boundObject from Mesh:
Code: Select all
Vector3[] vertices;
int[] indices;
List<Vector3> points = new List<Vector3>();
TriangleMesh.GetVerticesAndIndicesFromModel(boundModel, out vertices, out indices);
for (int i = 0; i < vertices.Length; i++)
{
vertices[i] = vertices[i] * Scale;
}
points.AddRange(vertices);
_convexHull = new ConvexHull(points, 10);
points.Clear();
_convexHull.CollisionInformation.LocalPosition = _convexHull.Position;
_convexHull.Position = Position; //Position to Model Pos
_convexHull.Orientation = Orientation; // Orientation to Model Orientation
Code: Select all
_convexHull.Position += _gameObject.Dir_Move * _gameObject.Speed;
Vector3 speedRVect = new Vector3(_gameObject.Dir_Rot.X, _gameObject.Dir_Rot.Y, _gameObject.Dir_Rot.Z)
* _gameObject.RotationSpeed;
Quaternion q = Quaternion.CreateFromYawPitchRoll(MathHelper.ToRadians(speedRVect.Y),
MathHelper.ToRadians(speedRVect.X), MathHelper.ToRadians(speedRVect.Z));
_convexHull.Orientation *= q;
_gameObject.Position = _convexHull.Position;
_gameObject.Orientation = _convexHull.Orientation;