I have a rectangular body that shoots from the canon at an angle of 45 degrees. The body also rotates at an angle of 45 degrees, and I set the mass in front of the body.
The body rises in the air, however, when the body returns to the ground, it does not rotate. Is there a way for the side of the mass to drop first?
My real world example is throwing a tennis ball with a string attached to the air. Currently, the line does not lag behind the ball when gravity comes into effect.
Here is my ball
Body = BodyFactory.CreateRectangle(world, ConvertUnits.ToSimUnits(texture.Width), ConvertUnits.ToSimUnits(texture.Height),100f, postition, this); Body.Mass = 1; Body.LocalCenter = new Vector2(ConvertUnits.ToSimUnits(Texture.Width), ConvertUnits.ToSimUnits(Texture.Height / 2)); Body.UserData = this; Body.BodyType = BodyType.Dynamic; Body.CollisionCategories = Category.All; Body.CollidesWith = Category.All; Body.IgnoreGravity = false; float ang = BarrelJoint.JointAngle; Body.Rotation = ang;
Then I do this to run it:
Body.ApplyLinearImpulse(new Vector2((float)Math.Cos(ang) * 100, (float)Math.Sin(ang) * 100));
I assume that there are some settings or calculations that I forget.
Jastill
source share