How to drop something to the floor with constant speed?

Hello guys

I’m trying to make constant speed rocks and I listen to collision between a warcraft and these rocks. here the dropping of the rocks:

    rock01 = new Spatial[10];
    for(int i = 0; i < 10; i++)
        float x = (rand.nextFloat() * (-14f)) + 7f;
        float y = (rand.nextFloat() * 8f) + 4f;
        rock01[i] = assetManager.loadModel("Models/rockModel01/Rock.j3o");

        rock01[i].setLocalTranslation(0, 6, 0);
        rock = new RigidBodyControl(0.1f);
        rock.setLinearVelocity(new Vector3f(0f, 0.1f, 0f));


if I use this rocks drop fast and accelerate.

if I change “rock = new RigidBodyControl(0.1f);” to “rock = new RigidBodyControl(0f);” and I add

     for(int i = 0; i < 10; i++){
             Vector3f h = rock01[0].getLocalTranslation();
             rock01[i].setLocalTranslation(h.x, h.y - tpf, h.z);

to simpleUpdate methode, at this time I cannot listen to collision.

I want to listen to collision and drop rocks with constant speed. How to do this?
My english is a little bad :smile:

Just set the linear velocity constantly in a physics tick callback.

Sorry, I publish by mistake before completing my question but you answered before me :joy:

The answer is the same, I think. You can’t get proper collisions on objects that you are teleporting.

How to set the linear velocity in a physics?
because if I make “rock = new RigidBodyControl(0f);” ,
“rock.setLinearVelocity(new Vector3f(0f, -0.1f, 0f));” don’t work, rocks don’t move.

Are you doing it in a physics tick callback or???

Sorry I’m a new. I supposed it’s same RigidBodyControl. How to do this in physics tick callback?

Also I could be wrong, but I guess new RigidBodyControl(0f) makes it simply static (i.e. doesn’t move, ever).
And what you saw was simply Gravity accelerating.

Maybe you could try leaving the 0.1f but using .setGravity(Vector3f.ZERO) instead.
(Though in the usual world you also have that acceleration, as well as mass is no factor for free-fall-speed. We just perceive it wrongly)

1 Like

I found this in only two clicks from the basic physics tutorial:

…you should do the tutorials if you are new.

Thanks, that’s work. :slight_smile: