Hello,
I'm building a very simple box catching game. Boxes fall from above, user drags a platform back and forth and catches and stacks the boxes. When I use a force to move the platform the stack of caught boxes move with the platform correctly though the control method isn't correct.
If I use draggable movie clip and use it's position to set the position of the catching platform via SetTransform (or SetPositionAndAngle) the caught and stacked boxes don't move physically with the platform. The stacked boxes wake from sleep but the platform just slips underneath them. Is there a way of using SetTransform (or SetPositionAndAngle) to move a body whilst keeping the physics intact?
My code is very simple and not worth looking at but if you're interested in the update I have:
var force:b2Vec2;
var currentObject = playerArray[0];
var position:b2Vec2;
position = new b2Vec2(velocityMarker.x / world_scale,460 / world_scale);
var transformer:b2Transform;
var angle = currentObject.body.GetTransform().R
transformer = new b2Transform(position,angle);
currentObject.body.SetTransform(transformer);
I'm building a very simple box catching game. Boxes fall from above, user drags a platform back and forth and catches and stacks the boxes. When I use a force to move the platform the stack of caught boxes move with the platform correctly though the control method isn't correct.
If I use draggable movie clip and use it's position to set the position of the catching platform via SetTransform (or SetPositionAndAngle) the caught and stacked boxes don't move physically with the platform. The stacked boxes wake from sleep but the platform just slips underneath them. Is there a way of using SetTransform (or SetPositionAndAngle) to move a body whilst keeping the physics intact?
My code is very simple and not worth looking at but if you're interested in the update I have:
Code:
var force:b2Vec2;
var currentObject = playerArray[0];
var position:b2Vec2;
position = new b2Vec2(velocityMarker.x / world_scale,460 / world_scale);
var transformer:b2Transform;
var angle = currentObject.body.GetTransform().R
transformer = new b2Transform(position,angle);
currentObject.body.SetTransform(transformer);