[Rescinded] Stack of blocks is getting hit before projectile reaches it

Topics: User Forum
Oct 4, 2010 at 10:56 PM
Edited Oct 4, 2010 at 11:23 PM

EDIT:  Nevermind.  I found the issue elsewhere...

Using v. 2.1.3

I've got a stack of square blocks (body and geom) on a pedestal that I'm firing a circular projectile at.  Among the other issues I'm having is that the blocks are getting pushed/knocked over BEFORE the ball reaches them.  The early collision does not occur at the point that the ball eventually reaches which is confusing.  The timing of the early collision is inconsistent as well; it varies between attempts even though I'm using the same values each time.

Does anyone have any suggestions of what I need to be looking at to find the cause of this?

Here is the code that creates and moves the projectile (where I'm assuming the problem lies):

 

void MakeProjectile(Vector2 position, float velocity, float degrees)
{
    //Create the body
    projectileBody = BodyFactory.Instance.CreateCircleBody(projectileTexture.Width / 2, GameConstants.ProjectileMass);
    projectileBody.Position = position;

    //Create the geometry
    projectileGeom = GeomFactory.Instance.CreateCircleGeom(projectileBody, projectileTexture.Width / 2, 47);
    projectileGeom.RestitutionCoefficient = GameConstants.ProjectileBounciness;
    projectileGeom.FrictionCoefficient = GameConstants.ProjectileFriction;

    //Give the projectile its velocity
    float radians = MathHelper.ToRadians(degrees);
    Vector2 v = new Vector2();
    v.X = (float)(velocity * Math.Sin(radians));
    v.Y = (float)(velocity * Math.Cos(radians));
    projectileBody.LinearVelocity = v;
    //projectileBody.ApplyImpulse(v);

    //Add it to the physics simulator
    simulator.Add(projectileBody);
    simulator.Add(projectileGeom);
}

 

The bounding box for the projectile is created by its texture which is square with the circle inscribed within in.

Any suggestions?