Motors and attachment points?
Posted: Thu Aug 04, 2011 3:22 am
it looks as if motors can only be attached between two objects at the centre point, but I want to be able to throw in an arbitrary attachment point. here are some use cases I need to consider:
the turret of a tank relative to the body, rotating on one axis; the attachment point of the turret to the body is not the centre of the tank, it is offset in the X and Z dimensions. This axis needs to stay relative to the position of the tank (i.e. if the tank is sideways on a hill, the turret stays in place)
the barrel as it is elevated up and down. this needs to be relative to the turret, but again, not attached at the centre.
part of the barrel flies inward using a linear motor, relative to the turret, which is relative to the tank.
I've read about the various joints and motors which are available, but I dont understand how to set the attachment point. What I want to do is implement the earlier suggestion of having a single dynamic body with various kinematic bodies, without any solver settings on them, attached to that body, via a motor.
[update]
ive looked at the ragdoll in UnfortunateGuyDemo and it appears that joints do allow arbitrary attachment points, but I only see 1 attachment point in this code,
how does this know where the attachment points are on both objects? It appears I've missed something critical in how this works.
the turret of a tank relative to the body, rotating on one axis; the attachment point of the turret to the body is not the centre of the tank, it is offset in the X and Z dimensions. This axis needs to stay relative to the position of the tank (i.e. if the tank is sideways on a hill, the turret stays in place)
the barrel as it is elevated up and down. this needs to be relative to the turret, but again, not attached at the centre.
part of the barrel flies inward using a linear motor, relative to the turret, which is relative to the tank.
I've read about the various joints and motors which are available, but I dont understand how to set the attachment point. What I want to do is implement the earlier suggestion of having a single dynamic body with various kinematic bodies, without any solver settings on them, attached to that body, via a motor.
[update]
ive looked at the ragdoll in UnfortunateGuyDemo and it appears that joints do allow arbitrary attachment points, but I only see 1 attachment point in this code,
Code: Select all
var ballSocketJoint = new BallSocketJoint(torso, upperArm, torso.Position + new Vector3(1, .7f, 0));
Space.Add(ballSocketJoint);