jME3a4: Problems with friction (rolling ball on terrain)

Hi there,



I am currently working on a realistic golf simulation software based on jME3.

Now that I am at the point to implement realistic ball physics, I got some problems with the friction of the ball.



I tried setting friction on the ball physic and on the terrain physics and both together.

But this did not affect the rolling behaviour of the ball on the terrain. The ball rolls until the end of the terrain

and never loses its velocity. Then I tried setting damping on the ball. But this slows down the ball continiousely.

And I only want the ball slow down, when it is rolling on the terrain.



Can anybody help me with this issue?



thanks!



greetings mw

You could for example listen to collisions with the floor and each time you register one you reset a timer of say 100ms which when ended sets the damping back to normal value. Since what you actually want is to simulate the grass stopping the ball you could also do a ray test downwards from the ball and check the distance to the floor, then based on that apply a damping or not.

Okay that was also a thought of me, but I hoped that there will be a native solution in jME like setting the friction.

So could you tell me what does the friction method of an physics object affect?

The friction of the objects surface. But that is not the question here, the friction of a tyre and a road only comes into play when you brake or accelerate fast, not when the wheel is rolling. Same for a marble rolling on a table.

each collision it does to the terrain, I run this:

[patch] float absorbEnergy = 0.99f;

setLinearVelocity(getLinearVelocity().mult(absorbEnergy));

setAngularVelocity(getAngularVelocity().mult(absorbEnergy));

[/patch]

I got a smooth earth slowdown effect :slight_smile:



also, the first hit it does to the terrain I use this:

[patch] if(getLinearVelocity().length() > maxVelocity/2f) //max velocity is what I set initially

setLinearVelocity(getLinearVelocity().mult(0.1f));

[/patch]

so anything hitting the terrain too fast will be abruptly slow down.



I tried, long ago, play with friction, damping (not on collision, I will try this later), and some other stuff I dont remember clearly…, but only a few weeks ago I begun taking care of this on the collision :slight_smile: