Body Dynamic and Kinematic intersect FPE 3.5

Topics: User Forum
Apr 16, 2014 at 7:26 PM
Image

The position of the kinetic object along the Y axis does not change.
X axis changes the FreeDrag gesture, adding DeltaX. Here is the code:
public Vector2 Position
        {
            get { return CoordinateHelper.ToScreen(body.Position); }
            set { body.Position = CoordinateHelper.ToWorld(value); }

        }
public void Update(float totalElapsedMilliseconds, float milliseconds)
        {
            while (TouchPanel.IsGestureAvailable)
            {
                gesture = TouchPanel.ReadGesture();
                switch (gesture.GestureType)
                {
                    case GestureType.FreeDrag:                        
                            plankaPosition.X += gesture.Delta.X;                        
                            break;
                }

            }

           Position = new Vector2(plankaPosition.X + 569.0f, plankaPosition.Y + 19);
     }
In the first case, the picture shows collision of the physical body and kinetic from the top. In this case, all good. because the Y position fixed.

In the second case, the picture shows collision of the physical body and kinetic from side. In this case, the physical body goes through kinetic kinetic move quickly if the body. the physical body does not bounce. At the border of kinetic and sits there)).

How to fix it?

Here are the parameters of these bodies.

Kinematic:
bodyPlanka.BodyType = BodyType.Kinematic;
Dynamic:
body = BodyFactory.CreateCircle(world, (Size.X * CoordinateHelper.pixelToUnit) / 2, 1, ballPosition, null);
            body.BodyType = BodyType.Dynamic;
            body.Restitution = 0.1f;
            body.SleepingAllowed = false;
            body.FixedRotation = false;
Apr 17, 2014 at 3:59 AM
This option moves the object more quickly than a gesture. Need the same speed.
 while (TouchPanel.IsGestureAvailable)
            {
                gesture = TouchPanel.ReadGesture();
                switch (gesture.GestureType)
                {
                    case GestureType.FreeDrag:
                                                   
                            body.LinearVelocity += new Vector2(gesture.Delta.X/2f, 0);

                        break;
                }

            }