PDA

View Full Version : Bullet Physics: Pendulum



Chrusion
10-18-2012, 06:44 PM
A search of the entire forum returns 3 posts about pendulums.

Since Bullet is the latest and greatest addition to LW, it seems it would be an easy few clicks to make an object swing like a pendulum, but obviously I can't figure it out. Seems all it is good for is falling objects, that is, I don't see any options in the rigid body properties to anchor an object to its pivot point so that it swings naturally. Is there a way to do so "clandestinely" so that Bullet's built-in gravity and other object params do their physically accurate thing?

What I'd like to do (without all the minutia of keys on every frame at critical points of action like colliding with another object) is to release a part on a machine that's in the "up" position (horizontal), have it swing down and oscillate a few times before coming in contact with a table-like surface that rises up to push the part back up in the opposite direction (which can be done by timing the collision of the static object table with the rigid part when it has swung past center).

.

jwiede
10-18-2012, 07:00 PM
Can't really simulate what you want without constraints. This is precisely why I keep complaining about how limited Bullet is without proper constraints. You can fake up something with keyframed animation, but it won't look right without a heck of a lot of tweaking.

erikals
10-18-2012, 07:27 PM
have they said anything about adding constraints? (would be good, as it is very needed...)

Chrusion
10-18-2012, 08:40 PM
Really??! WHY hasn't this stuff been put in LW by now? Com'on! How long has the competition had this most basic of animation tools? 15 years? A dynamics driven pendulum for cryin out loud! Hey, shutup over there. Maya, Max, CD4, and XSI guys are ruthlessly snickering behind my back.

cagey5
10-19-2012, 03:02 AM
Would it work if you modelled the top of a pendulum as it would be in reality? A hook on a pin or through an eyelet.

Chrusion
10-19-2012, 07:23 AM
You might have something there! Use the parent object with a hole in its hinge as a static collision for the pivot pin of the rigid body! I shall try. Thanks.

Chrusion
10-19-2012, 12:17 PM
Nope. Didn't work. Basically I made four square 1/4" thick plates with 1.5" dia. holes in them, two plates per 1" dia. pin on the rigid body pendulum object, which is basically a U-shaped tube like below (dots are spaces since html ignores real spaces...

..hinge
..plates
=[]=[]=...........=[]=[]= pin
....||...................||
....||...................||
....||____________||
.....\_____________/
pendulum-like object

The pendulum object (with pins) just fell thru the hinges and collides just enough to make the pendulum object fall at a canted angle that dislodges it from the hinges, instead of falling straight down as it does when the hinge object is disabled. Played with the various params going min to max in all the various permutations for both rigid and static bodies.

Oh well.

cagey5
10-19-2012, 12:52 PM
Just got in so only just found time to try this

http://www.youtube.com/watch?v=tv3SBH6fNYU&feature=youtu.be

Make layer one rigid body and layer two static.


And another attempt based on your double hinged pendulum. Ran for 800 frames

http://youtu.be/l88oWJrAlyI

jwiede
10-19-2012, 01:35 PM
Every test I tried that way ran into problems in how the "scaled-up hinge" (or whatever) moved: Sometimes they'd "work", but they never produced the smooth, low-friction kind of operation expected from a simple metal hinge or pivot. Further, it always bloated the sim time (and construction time) enormously compared to using a Bullet implementation with constraints available.

cagey5
10-19-2012, 01:52 PM
...... compared to using a Bullet implementation with constraints available.
You're probably right. I'm just trying to tackle the problem with what's currently available. That's how deadlines are met.

cagey5
10-19-2012, 02:03 PM
Just for the heck of it.

http://youtu.be/tHQ3w5R4eTU

UnCommonGrafx
10-19-2012, 04:52 PM
Nice test. Made me go look.
I had fun playing with a test of a similar kind. Seems the convex shape of a part works well for that inner 'hub' space.
It seems physical constraints are the one's that we have at the moment.

Chrusion
10-19-2012, 05:49 PM
Well Cagey, your sample objects worked great. But when I conformed my objects to be like yours, specifically the pendulum pivot like a hook and the hinge with a full length pin, my setup doesn't work. The pendulum hangs for 3 frames, then falls thru the hinge pin. The only difference is I need to set pivots in modeler, so my objects are not modeled at 0,0,0. See my test scene...

dwburman
10-20-2012, 10:57 AM
Here's a scene that seems to work at least somewhat.

The main changes I made:


1) Separated the bar from the hinge bracket thing and changed the collision mesh type to 'box' with bounciness and friction at 0%. By default, LW uses the mesh itself to calculate the dynamics, but in this case it was causing too much interference or something. Even setting the bar to cylinder didn't work as well as setting it to box.

2) Increased the size of the eyehole on the pendulum part. I also added extra geometry, but I'm not 100% sure that helped.

3) Added a null and made it a bullet collision object with a box shape. I then scaled/rotated/positioned it in place to keep the pendulum from sliding off the bar. The hinge bracket things were causing it to jump.

108635

XswampyX
10-20-2012, 04:49 PM
If we had constraints this would be so much easier. :)


http://youtu.be/ElPvhctpIcI

Chrusion
10-20-2012, 05:41 PM
Nice work around, Dana, but I just discovered another shortcoming of Bullet... it ignores parenting. That is, I need this swinging chute object to be parented to a base object that rises up off the ground and moving backward on Z as it goes, following an arc. The chute needs to fall and collide with the ground as its base (to which the hinge is attached) rises up on Y and moves back on Z. The base will rise higher than the length of the chute, thus the chute will swing after leaving contact with the ground.

LOL... not a tall order for a dynamics system, but it appears impossible to do in LW. I've already have a hand-keyed version of the animation, so this sim is not critical to the project, but it was supposed to be a chance for me to learn how to use bullet. My industrial anims of large machines have always required LW do what it can't. Sad. In fact, I had to jump ship and use Maya N-particles to accomplish a gravel mixing sim via an auger screw... you know, 100K self-colliding particles that filled a volume. It appears bullet can do this in LW, so if I need to fill another container with gravel, I might not have to use Maya. It just amazes me that this swinging chute thing, being thousands of times simpler, can't be done in LW with a 100% dynamics driven approach.

Thanks for all your help, guys. I guess we'll just have to wait several more years for the LW implementation of Bullet to grow up to do something so simple. A constraint system isn't going to help if you can't parent rigid items to kinematic items (I tried changing all objects to kinematic... no diff).

Chrusion
10-20-2012, 05:45 PM
Very lovely! Can that red wheel be parented to another object that also moves? I don't understand how this was done in LW given all the issues we're run into here.

XswampyX
10-20-2012, 05:50 PM
Yes. Parenting works, sort of. You have to do your parenting, save, quit out of layout and then reload. Clearing the cache doesn't work...... I don't know why.

Will post the scene tomorrow. I'm off to bed. :-Z zzzzz

dwburman
10-21-2012, 12:45 AM
I did wonder if you could do what you needed with simple 2pt poly chains and clothFX to calculate the dynamics and FX hardlink to connect the real geometry.

Of course, pivots, etc would certainly be a welcome improvement in LW's bullet implementation.

erikals
10-21-2012, 02:44 AM
2pt poly chains and clothFX, yep, was wondering about that yesterday... could be...

Matt
10-21-2012, 02:56 AM
have they said anything about adding constraints? (would be good, as it is very needed...)

We've been fleshing out the Bullet implementation in LightWave, 11.5 will bring Soft Bodies. Constraints *will* be added, they may not make it in 11.5 however, we'll have to see.

XswampyX
10-21-2012, 03:29 AM
We've been fleshing out the Bullet implementation in LightWave, 11.5 will bring Soft Bodies. Constraints *will* be added, they may not make it in 11.5 however, we'll have to see.

Looking forward to it!

Here's the scene. 108650

COBRASoft
10-21-2012, 12:50 PM
Hey Matt, quick question about LW11.5 and Bullet. Will stuff like dominos be much easier to do? Now they keep 'dribbling', no matter what settings I try. It would be nice if we could implemente something like 'deactivation' or 'rest' time or frames.

erikals
10-21-2012, 01:05 PM
(the domino test thread > http://forums.newtek.com/showthread.php?131058-Help-Domino-Bullet)

COBRASoft
10-21-2012, 06:19 PM
^^ thx erikals :)

- - - Updated - - -

^^ thx erikals :)

UnCommonGrafx
10-22-2012, 05:37 PM
I had to play.

I made a few versions.
My differences are:
- Initially, I just tried to get it to swing. 1mm collision and changing the fps numbers got it working, 800 first but 200 seems to be ok.
- After that, I tried to get the part to move and not slip off. Added a piece to hit it to begin the motion.
- Finally, tried your scenario. The dynamics time for my settings are... glacier as compared to most other sims I've done with Bullet to date.


I concur that constraints are needed, as much if not more than softbodies. The time with it was reminiscient of working with clothfx and I don't think that's the experience NT wants users to have. Read: frustrated.

It can work, though. Thanks for the 'workout'.

(Ha, I've tried to send this a few times over the weekend. Tests would work, furthering my delay of sending this note. Today, it all came together in the below "E" file.
I'm including the pre-working files out of completeness.
Dynamic files have been removed: +38 meg)

108696
108689
108690
108691
108692
108694
108695

Chrusion
10-23-2012, 08:24 AM
Thanks, Uncommon!

Can you see if you can get the hinge to move upward so that the chute slides off the box (or a stretched out version of the release object) and swings a little as it leaves contact? I tried parenting the hinge object to a platform that rises up and back, but the the blue outlines of the dynamic objects didn't follow, even after exiting Layout and reloading.

Where is the bullet FPS sampling option at?

10-23-2012, 10:29 AM
haha,
Got-dangit! I worked all weekend for it to NOT do that!

Yeah, that's easy!! (He says, in a maniacal moment at work.)

I'll have a play this eve. Or today if they will leave me alone a bit. (This is UnCommonGrafx at work)

FPS is in the world section of the bullet panel.

UnCommonGrafx
10-23-2012, 04:36 PM
Have time enough to say yes and example:
108724
108725