Hello!
Has anyone made effect like that (attention on car’s antenna)?
I have absolutely no idea how to do this.
May be someone has an experience in that kind of features?
I don’t even know how this behaviors named so i can’t even google it
Hello!
Has anyone made effect like that (attention on car’s antenna)?
I have absolutely no idea how to do this.
May be someone has an experience in that kind of features?
I don’t even know how this behaviors named so i can’t even google it
Hi Pashtet,
Sounds like you might be looking for how to use a physics engine, and specifically how to use spring joints (they’re mentioned on that doc page). There’s also a Playground demonstrating the use of Cannon’s built-in spring physics joint.
https://www.babylonjs-playground.com/#1BHF6C
You might have to play around with it a bit if you’re going for a particular look/feel to the physics, but I think that’s a good place to start. If you end up wanting more precise control, it’s also not too difficult to write a custom “toy” spring mechanism to achieve a certain look (here’s a quick one that doesn’t bother much with physical accuracy, but looks kind of fun). Hope this helps!
Thank you so much! I’ll try it:)
Old, but might help -
https://blog.raananweber.com/2016/04/03/cloth-physics-simulation-for-babylon-js/
(Shameless self-promotion! )
Thank you! I have already red your article, it awesome) But I a bit confused with that method, I can’t use this method when I’m using 3d model more complex than plane. At times, it seems to me that Skeloton and Bones are right way to solve my problem. But I haven’t found how to apply physics to Bone at the moment .
Physics on bones will work very similar to the way the cloth is working - you add particles to the bone’s position, connect them with any join you think fits (distance joint exists in all engines, spring joint is available in cannon) and update the bone’s position every frame based on what the physics engine delivers back. So:
If you limit the joint’s allowed angles you can get the effect you wanted
On a different note, you can achieve this effect without a physics engine (at least not on the antenna). Create the mesh, and update its movement according to the change in acceleration in the (local) Z axis of the car. You know the car is moving in a specific speed - move the upper pat of the antenna a bit to the back if it goes forward. When the can breaks (acceleration delta is negative) start moving the antenna forward. I dont see why it can’t look realistic without a physics engine.
I have tried to implement this feature, but faced with problem with gravity (Distance and Spring joints doesn’t have “lock” features). I have tried to implement with LockJoint and I’ve got some results - Babylon.js Playground
I keep trying
Hi guys. https://www.babylonjs-playground.com/#480ZBN#108
Seeing we have AmmoJS nearby, we also have ropeImpostors nearby.
Just begun. Started with someone elses PG. That whole PG series is packed-with Ammo soft-body demos, I believe.
Forced-positioning in line 35… never a good idea for a mesh with a physicsImpostor, so might be troubles there. Plus, I dunno if a rope impostor is SUPPOSED TO work… “standing”. I don’t know how to set its restitution, mass, inertia, etc, either. New stuff for Mr. Wingnut.
Are we seeing SOME “bend” as this thing cycles laterally? Not sure. It seems opposite bend-direction from what it should be. Could be eye-foolery.
https://playground.babylonjs.com/#1KPF49#42 - Classic chain of hinge joints in Cannon… MIGHT be able to be made “stiff” by moving connectedPivots on joints… up or down. Not sure. Might be difficult to replace spheres with tube-sections. All sorts of obstacles to “smooth linear bend” there, too. Essentially, this is one “column” of cloth… using larger sphereImpostors instead of particleImpostors or Ammo’s method.
How about using a point-to-point joint?
Thank you, Master
I changed bones position synchronisation to rotation, now it looks almost as I wish. https://www.babylonjs-playground.com/#5GPE0Q#4
Now I’ll try to make it more solid (elastic)
Awesome!!!
With your permission, I am going to make it a WebXR boxing scene . Seems like a perfect way to test physics on the controllers
Of course! I will only be happy
Meh Ammo… It can do everything, but it so difficult for me. I think Cannon.js is my limit:)