MogreNewt manual control

Lesmian

09-07-2014 22:11:20

Hi,
I have some concerns about manually controlling bones while using MogreNewt for collision detection (no physic). So I was able to prepare all data, read meashes, create collision objects ect. Then I created simple material pair for arm and chest (represented by Capsule and Box shapes). I passed my MyCustomContactCallback and it works. However I don't know how I can prevent arm (capsule) object from intersecting (overlapping) with chest (box). I thought that I will be storing last good orientation/position before collision occurs, but that don't work. My animation just stops after collision and I cant move it again. I move objects using SetPositionOrientation, cuz I use my own IK solver to move bones and I don't need physic form Newton. For now my code look like this:

mWorld.CollisionUpdate();
if (forarm != null && !collision)
{
bod2.SetPositionOrientation(forarm._getDerivedPosition(), forarm._getDerivedOrientation());
var b = Engine.Instance.GetBone("upper_arm.R");
b.Orientation = orientation;
}
else
{
var b = Engine.Instance.GetBone("upper_arm.R");
b.Orientation = prev_orientation;
bod2.SetPositionOrientation(forarm._getDerivedPosition(), forarm._getDerivedOrientation());
collision = false;
}

Is that a correct way to do this? Or maybe its a simpler way to prevent overlapping with Newton?

Zonder

11-07-2014 08:12:25

This might be better in the OgreNewt board as it looks not mogre specific