Sample of falling coins by physics

I made a sample of falling coins in Babylon.js.
Coins created with PBR materials are displayed neatly.

babylonjs_medal_test_003

11 Likes

Can you please make it so that they would fall in my wallet :money_mouth_face:

4 Likes

If you tweet about it let me know we will retweet it frombjs account

This is gold :smiley:

1 Like

Thanks! Here is my tweet.

1 Like

Havok physics seems to allow more coins to fall.

1 Like

To enjoy the surface materials and the feeling that money flows into my direction, I modified your example a bit :slight_smile:

Test of falling Coins with physics | Babylon.js Playground (babylonjs.com)

1 Like

The feeling should be even better in XR! :rofl: through the coins make me think more of those delicious chocolate coinsā€¦ :yum:

2 Likes

I changed the coin into chocolate.
Unfortunately it didnā€™t look as authentic as the coin. Anyone know a technique to make chocolate look real?

babylonjs_havok_test_003

1 Like

@cx20 when i saw this example on my vr glasses i had to think of your gold rush demo. i am about to write the mentioned example in babylon but maybe you beat me to it. Unfortunately, to get into the enjoyment of the sham slingshot you need a vr controller: you hold in your hand bills that you can scatter around you. super cool feeling! :smiley:

three.js vr - make it rain

1 Like

Unfortunately I donā€™t have vr glasses right now, so I donā€™t think Iā€™ll port the three.js vr sample.

Speaking of which, if you ask ChatGPT GPT-4, they might be able to help you port from three.js to Babylon.js.

I impulsively wanted to try the ChatGPT port. Below is the result of porting.

VR feature is not built in (because I am not familiar with Babylon.js VR function)

1 Like

Almost correct but I need an impulse upwards.

This example has still wrong impulse but it shows the right smooth behavour.
Babylon.js - make it rain | Babylon.js Playground (babylonjs.com)

This is what I want have:
Euro Geldschein Pistole selber bauen Geld werfer basteln aus Pappe - cardboard dollar money gun DIY - YouTube

ā€¦ and nice to have: a flexible paper simulation

ā€¦ and my money should stay on the ground, please :slight_smile:

1 Like

Fixed it a little. I think that changing CreatePlane to CreateBox solved the transparent problem.

1 Like

Thank you, I can re-run the example all day long! :slight_smile:

1 Like

Perhaps if we start using Havok, we will be able to increase the number of bills.

2 Likes

BTW, Iā€™ve noticed a problem with how coins are recycled after they fall below the ground. I think it could have been improved by:

/*
    mesh.position = getNextPosition(50);
    mesh.aggregate = new BABYLON.PhysicsAggregate(mesh, BABYLON.PhysicsShapeType.CYLINDER, { mass: 1, friction:0.4, restitution:0.8 }, scene);
*/
    // Improved performance by referring to:
    // https://doc.babylonjs.com/features/featuresDeepDive/physics/perfTips

    const body = mesh.aggregate.body;
    const pos = getNextPosition(50);

    body.disablePreStep = false;
    body.transformNode.position.set(pos.x, pos.y, pos.z);
    body.setLinearVelocity(new BABYLON.Vector3(0,0,0));
    body.setAngularVelocity(new BABYLON.Vector3(0,0,0));

Sure. Just change your prompt of ā€˜material = chocolateā€™ to ā€˜material = swisschocolateā€™ :grin:
Itā€™s just a matter of having the right quantity of sugar, good quality milk and nicely roasted cocoa beans :stuck_out_tongue_winking_eye:

Donā€™t ask for the recipe; Itā€™s :face_with_hand_over_mouth: :rofl: secret

1 Like

I think I got closer to the chocolate material thanks to your advice.
babylonjs_havok_test_004

1 Like

It was essentially a joke :grin:. I only took two minutes twisting a few things in the materials.
I believe to make a realistic chocolate texture would require to create either a detail or clearcoat texture similar to a ā€˜rubber-likeā€™ design. Choc is rarely just completely flat. Itā€™s a liquid turned into solid and it does catch some of the light and env. It needs to look a bit more ā€˜organicā€™.

1 Like

I might have gotten another chocolate ball while trying the clear coat.

babylonjs_havok_test_005

1 Like