Bepu Info Collision and Dynamics
Posted: Tue Jun 12, 2012 4:03 pm
Hi, I'm new in the world BEPU.
I am making a little game of football (soccer).
I have several questions about the use of the library:
a) I created a sphere (entity) holding my 3D ball (model) and cylinders that contain the 3d soccer goal. Why the ball collides with a cylinder only if kicked low shot (and not in air)?
Box soccergoal= new Box(new Vector3(0,0f,-1100),630,240,100);
space.Add(soccergoal);
modelsoccergoal = new EntityModel(soccergoal, content.Load<Model>("soccergoal"), Matrix.Identity, myCamera);
soccergoal.Tag = modelsoccergoal;
soccergoal.CollisionInformation.Events.DetectingInitialCollision += HandleCollision;
Cylinder poledx = new Cylinder(new Vector3(-350f, 0f, -1090), 250f, 35f);
Cylinder polesx = new Cylinder(new Vector3(350, 0f, -1090), 250f, 35f);
Cylinder poleup = new Cylinder(new Vector3(360, 250, -1090), 710f, 15f);
poleup.Orientation = Quaternion.CreateFromAxisAngle(Vector3.UnitZ, MathHelper.PiOver2);
space.Add(poledx);
space.Add(polesx);
space.Add(poleup);
poledx.CollisionInformation.Events.InitialCollisionDetected += HandleCollisionPole;
polesx.CollisionInformation.Events.DetectingInitialCollision += HandleCollisionPole;
poleup.CollisionInformation.Events.DetectingInitialCollision += HandleCollisionPole;
In this code, HandleCollisioPole is triggered only if ball run on the soccer field and not in the air. I apply an arbitrary impulse (Is it right?) to the ball when kicked.
b) the ball trajectory after it slammed on the soccer ball pole is changed by BEPU automatically, right?
c) Should I create a goalkepper that dives: the animation is done in software modeling? How to manage collisions of an animated 3D model?
Thanks in advance
I am making a little game of football (soccer).
I have several questions about the use of the library:
a) I created a sphere (entity) holding my 3D ball (model) and cylinders that contain the 3d soccer goal. Why the ball collides with a cylinder only if kicked low shot (and not in air)?
Box soccergoal= new Box(new Vector3(0,0f,-1100),630,240,100);
space.Add(soccergoal);
modelsoccergoal = new EntityModel(soccergoal, content.Load<Model>("soccergoal"), Matrix.Identity, myCamera);
soccergoal.Tag = modelsoccergoal;
soccergoal.CollisionInformation.Events.DetectingInitialCollision += HandleCollision;
Cylinder poledx = new Cylinder(new Vector3(-350f, 0f, -1090), 250f, 35f);
Cylinder polesx = new Cylinder(new Vector3(350, 0f, -1090), 250f, 35f);
Cylinder poleup = new Cylinder(new Vector3(360, 250, -1090), 710f, 15f);
poleup.Orientation = Quaternion.CreateFromAxisAngle(Vector3.UnitZ, MathHelper.PiOver2);
space.Add(poledx);
space.Add(polesx);
space.Add(poleup);
poledx.CollisionInformation.Events.InitialCollisionDetected += HandleCollisionPole;
polesx.CollisionInformation.Events.DetectingInitialCollision += HandleCollisionPole;
poleup.CollisionInformation.Events.DetectingInitialCollision += HandleCollisionPole;
In this code, HandleCollisioPole is triggered only if ball run on the soccer field and not in the air. I apply an arbitrary impulse (Is it right?) to the ball when kicked.
b) the ball trajectory after it slammed on the soccer ball pole is changed by BEPU automatically, right?
c) Should I create a goalkepper that dives: the animation is done in software modeling? How to manage collisions of an animated 3D model?
Thanks in advance