Why is the ball always moving?

I modified the friction parameters,but they did not take effect.For xample,A ball is moving,It just gets slower while

colliding with the wall or other things.It has confused me for a long time,and also done many test.But the effect was

unconspicuous.

How to set the friction?And maybe there are other things which bring this kind of problem.

Thans.

yuyang

[412 byte] By [yuyang] at [2008-1-8]
# 1

How do you set the ball to move ? Are you applying some kind of force to the ball ? Do you want to set the friction on the ball or the ground ?

You can set the friction (static and dynamic) of the ball as follows.

Code Snippet

void CreateBall()

{

SphereShapeProperties property = new SphereShapeProperties();

property.Radius = 1.0f;

property.MassDensity.Density = 1.5f;

property.Material.DynamicFriction = 0.1f;

property.Material.StaticFriction = 0.1f;

Shape sphere = new SphereShape(property);

SingleShapeEntity ball = new SingleShapeEntity(sphere, null);

ball.State.Name = "Ball";

ball.State.Pose.Position = new Vector3(0, 0, 0);

}

To set the friction on the ground, this is what you can do. The code indicates a dynamic and static fricition of 0.5 newtons.

Code Snippet

void AddGround()

{

// create a large horizontal plane, at zero elevation.

HeightFieldEntity ground = new HeightFieldEntity(

"simple ground", // name

"03RamieSc.dds", // texture image

new MaterialProperties("ground",

0.2f, // restitution

0.5f, // dynamic friction

0.5f) // static friction

);

SimulationEngine.GlobalInstancePort.Insert(ground);

}

Let me know if you still need help.

Courageous

Courageous at 2007-10-2 > top of Msdn Tech,Microsoft Robotics Studio,Microsoft Robotics - Simulation...
# 2

Hi,Courageous

I make a robot hit the ball,and then the ball moves.But it rotates at the same speed,just like I said before.

I have set the friction,but it seems to be not work.

yuyang

yuyang at 2007-10-2 > top of Msdn Tech,Microsoft Robotics Studio,Microsoft Robotics - Simulation...
# 3
So what I am getting out of here is that you are trying to hit a ball with a Robot and the ball keeps rolling of infinitely. If that is the case then it seems that the mass of the ball is really small. Try increasing the mass of the ball and see if it works. Also keep in mind that since the ground is flat MSRS and a threshold of force on a rolling object keeps the object rolling due to lack of an opposing force to stop the object. Hope this helps.
Courageous at 2007-10-2 > top of Msdn Tech,Microsoft Robotics Studio,Microsoft Robotics - Simulation...
# 4
Hi,Courageous

Thank you for your help.

The mass of ball is increased,but ....

Now I think why the friction do not work.There are three parameters which we set,aren't there?Any other

parameters?Is there something else causing this problem..

yuyang

yuyang at 2007-10-2 > top of Msdn Tech,Microsoft Robotics Studio,Microsoft Robotics - Simulation...
# 5
Is it okay with you, if I can have a look at your code? That way I can know what exactly is going on.
Courageous at 2007-10-2 > top of Msdn Tech,Microsoft Robotics Studio,Microsoft Robotics - Simulation...
# 6

The ball:

Code Snippet

private void AddBall()
{
SphereShapeProperties cSphereShape = null;
cSphereShape = new SphereShapeProperties(0.5f, new Pose(new Vector3(0f, 0f, 0f)), 0.02f);
cSphereShape.Material = new MaterialProperties("bphere", 0.5f, 1f, 10f);
cSphereShape.DiffuseColor = new Vector4(0.9f, 0.3f, 0.1f, 1.0f);

_state.ball = new SingleShapeEntity(new SphereShape(cSphereShape), new Vector3(1.1f, 0.1f, 0.45f));
_state.ball.State.Name = "Ball";

SimulationEngine.GlobalInstancePort.Insert(_state.ball);
}

The field:

Code Snippet

private void AddField()
{

BoxShapeProperties cprop = new BoxShapeProperties(
0.0f, // mass in kilograms.
new Pose(new Vector3(0.0f, 0.0f, 0.0f)), // relative pose
new Vector3(3.0f, 0.002f, 2.0f));
cprop.Material = new MaterialProperties("cprop", 0.5f, 0.5f, 0.5f);
SingleShapeEntity field = new SingleShapeEntity(
new BoxShape(cprop),
new Vector3(1.0f, 0.002f, 0.9f - 0.0125f));

field.State.Assets.Mesh = "field.obj";
field.BoxShape.State.DiffuseColor = new Vector4(0.0f, 0.0f, 0.0f, 1.0f);
field.State.Name = "field";

SimulationEngine.GlobalInstancePort.Insert(field);
}

That are my code snippets above.Please help me modify them to solve the problem.

Thanks!

yuyang

yuyang at 2007-10-2 > top of Msdn Tech,Microsoft Robotics Studio,Microsoft Robotics - Simulation...
# 7

Changing the friction won't have a significant effect on the rotation of the ball unless the ball is skidding across the ground rather than rolling. When the ball is rolling, it loses very little (if any) energy due to its friction with the ground, it loses nearly all of its energy due to air resistance. Unfortunately, the Ageia engine does not model air resistance.

They have included a parameter that will help, though. You can specify angular and positional damping parameters which will damp the motion of the ball and eventually cause it to stop. For any entity, you can set the following:

State.MassDensity.LinearDamping = 0.05f

and it will provide drag on the linear movement of the entity. In the case of a ball, it will cause it to eventually stop rolling. Ageia doesn't provide a good description for the value that damping should be set to so you will have to experiment with different values until you find something that seems realistic.

-Kyle

KyleJ-MSFT at 2007-10-2 > top of Msdn Tech,Microsoft Robotics Studio,Microsoft Robotics - Simulation...
# 8

Thanks for your help!The problem has solved.

yuyang
yuyang at 2007-10-2 > top of Msdn Tech,Microsoft Robotics Studio,Microsoft Robotics - Simulation...

Microsoft Robotics Studio

Site Classified