public Floor(Game game, Model model, float d)
: base(game, model)
{
body = new Body();
collision = new CollisionSkin(null);
collision.AddPrimitive(new JigLibX.Geometry.Plane(Vector3.Up, d), new MaterialProperties(0.2f, 0.7f, 0.6f));
PhysicsSystem.CurrentPhysicsSystem.CollisionSystem.AddCollisionSkin(collision);
body.ApplyGravity = false;
}
public override void ApplyEffects(BasicEffect effect)
{
effect.DiffuseColor = new Vector3(200.0f,0.0f,0.0f);
}
public void rotate(int direction)
{
if (direction == 1)
{
Matrix rotation = this.PhysicsBody.Orientation;
Vector3 position = this.PhysicsBody.Position;
rotation *= Matrix.CreateRotationX(0.0001f);
this.PhysicsBody.MoveTo(position, rotation);
this.PhysicsSkin.ApplyLocalTransform(new Transform(Vector3.Zero, Matrix.CreateRotationX(0.0001f)));
}
}
}
This is the code i'm using to create the floor as a plane (there are another 3 movement directions i've left out as they are the same as the 1st), however it's now experiencing a problem whereby the sphere will land on the plane and when the planes rotation is changed the ball will drop down onto this lower place but not roll. Is this due a force needing to be applied in order to make the sphere roll?
Also when the plane is rotated the other way the sphere will not move up the plane, it simply falls through it. E.G. if the ball is on the left edge which is lower down than the right, plane is then rotated to life the left side up however the sphere does not follow this movement and instead remains stationary.
Any ideas?