Code: Select all
CorrectionFactor = 300f;//correctiveStrength;
LinearDamping = 1f;//linearDamp;
AngularDamping = 1f;//angularDamp;
How can this be fixed?
Code: Select all
CorrectionFactor = 300f;//correctiveStrength;
LinearDamping = 1f;//linearDamp;
AngularDamping = 1f;//angularDamp;
Code: Select all
public void ReleaseGrabbedEntity()
{
IsUpdating = false;
// Entity will deactivate if velocity is low due to damping
// Activate the entity to wake it up again so it can be affected by gravity
Entity.IsActive = true;
//game.Space.Entities[game.Space.Entities.IndexOf(Entity)].IsActive = true;
Entity = null;
}
No, that should work. The methods that wake objects up with forces just use a form of that property internally. Something a little different may be happening. It could be that the grabspring's damping is still around from the previous frame. Despite being forced active right before that frame, it will go right back to sleep if it still has extreme damping.Is there another property that wakes the object up without applying forces?
Unfortunately this suggestion doesn't work and the Entity remains asleep.Another option would be to set the entity's IsAlwaysActive to true for the duration of the hold.
The EntityMover class requires a non null Entity in its constructor, so I have opted to use the SingleEntityLinearMotor class instead.Using a SingleBody(Angular/Linear)Motor to control the position/orientation of an entity, possibly through the EntityMover/EntityRotator convenience classes
Code: Select all
public ObjectMover(Game1 game)
{
this.game = game;
motor = new SingleEntityLinearMotor();
motor.IsActive = false;
game.Space.Add(motor);
}
Code: Select all
public void Draw()
{
if (!motor.IsActive)
{
return;
}
game.WireShapeDrawer.DrawLine(motor.Entity.InternalCenterOfMass, motor.Point, Color.Red);
}
Code: Select all
public void Setup(Entity e, Vector3 grabLocation, Vector3 offset)
{
motor.IsActive = true;
motor.Entity = e;
motor.LocalPoint = offset;
motor.Point = grabLocation;
}