Jump to content

Trying to create a gravity simulation


WHD
 Share

Recommended Posts

Hi All,

 

Been a while since I was here last. Things have been slow for a while now in the 3D business side of my work.

 

I am testing right now for a potential project. My goal is to create a visual representation of gravity similar to the effect you see with the distorted grid used in many shows to suggest the effect of the gravitational field on celestial bodies.

 

My aim is to try something that is stylistically new. To that end I'm trying to make a matrix of cubes in 3 dimensions. Imagine a planar grid and upon each vertex is placed a tiny cube Remove the grid so that only the cubes remain. Now replicate this grid of cubes and displace it perpendicular to the face of the original plane by the distance between each cube. We now have a 3D field of cubes.

 

The idea is to attract the cubes to a sphereical body as it passes through the field. As the sphere passes out of range the matrix of cubes returns to it's original position.

 

I have tried to use Bullet and forces to achieve this and am having issues getting the correct effect.

 

I have simplified the project to test my methodology. There are 4 objects.  Here are their curent settings.

 

First is a gravitational marker object (cube) with its link type set to free, its limit position settings on and set so that it will not move beyond + or - 20 EI units in all directions .

 

Second, I placed at  the cube's center a (force object) with it's linktype set to lock since it is the force that I want to hold this element of the matrix together. It is set to attract the gravitational object to it and hold it in place. The force object has a range of 100 and a power of .5 It also has an acceleration of 1.0 and is set as an attractor with force center as its setting. A spring factor of .5.

 

The next object is another force object. It is also set as an attractor. It has a Xform range of 1000 units in all directions with a drop off of .5.  Its properties are set as follows. Acceleration is 2 . It is an attractor set to force center. with a spring factor of .5.

 

This object is also animated to move across the space of the test. It begins with its dropoff range beyond the gravity detector cube. As it moves the cube enters its field and is attracted to it as planned. The problem is that the cube then follows the moving field and does 2 unexpected things.

 

1.) it ignors it's link limits and moves beyond 20 units.

 

2.) it is not returning to its other force object when the moving force passes out of range.

 

Any suggestions on what I can do to fix this are welcomed.

 

Once I get a single cube behaving as expected I then need to set hundreds of them into the matrix configuration that I mentioned earlier so methods need to be compatible with this goal.

 

Hope this makes sense. Thanks in advance for any suggestions.

 

Sincerely,

 

Bill Dempsey

Link to comment
Share on other sites

Hi Chip,

 

I think the best sample is the project itself. The 4 objects are 2 forces, a small cube and a large sphere. The reaction I'm getting is close to what I want but the hierarchy limits setting is having no influence as far as I can see. The sphere is not part of the sim. Just there for the visual.

 

Here is a link to the project file on my ftp: I'll keep it live for a few days.

http://www.digitaldempsey.com/ftp6/

Bill

Link to comment
Share on other sites

Hi Chip,

 

Seems the zip archive got scrambled. I have re-zipped it and tested the file and it is working here now . I hope the effect will be the same for you. Thank you for your persistence.

 

 

Link is the same as above. There are now 2 identicle project files in case the name convention was part of the issue.

 

Bill

Link to comment
Share on other sites

Hi Chip,

 

Made a breakthrough of sorts. I think I have it working almost as expected. My current test is rendering now.

 

Had to change the linkage arrangement and added a new boundry object to contain the gravity grid elements. If this test looks good I will post the results soon.

 

Bill

Link to comment
Share on other sites

Hi Bill-

 

I was just about to update that I'm finding the same result as you did, and also tried adding a cube to constrain the gravity grid elements.  But it still didn't behave as well as I'd like, and was about to get back to it ( which I will).  Please let me know if you found a solution.  Your approach is what I, and most people, would have done.  It would be good to know why it didn't work for future reference.  (Sorry for the delay - I had visitors from out of state.)

 

Chip

Link to comment
Share on other sites

Hi again Bill-

 

Did you get your Bullet simulation to work?  I finally did, but only for a two-body system.  I got the large sphere to attract a cube, and then have the cube return to it's original position.  But scaling it up for hundreds of cubes would be a challenge.  I'm still trying to figure out a better way to approach this.  Any luck with your attempts?

 

Chip

Link to comment
Share on other sites

Hi Bill,

 

         Correct me if I’m wrong, but I think this is what you were looking for.  This is a planar arrangement of cubes, not a cubic array.  But it results in a very nice organic looking undulating wave, and I think that’s what you were trying to achieve.  I needed some input from the Igors, and only then did I realize that I was trying to control the forces with their dropoff values, and I should have been keyframing their accelerations.  Check the file, and you’ll see what I mean.  I think there will be “complications†extending this concept into a 3D grid with a cube at each vertex location.  You’ll obviously have to repel the spheres, rather than attract them to pass through the array.  But this may be a good starting point for your experiment.  Chip

Link to comment
Share on other sites

Hi Chip,

 

I did get it working. Not perfectly but the results are tolerable. I am interseted to see what you have created. As ususal I became distracted when a client asked for something and have been dealing with that since my last post. I will try to post my results today for you to see.

 

I don't see a link or attachment on your post so let me know how to see what you have done.

 

Thanks,

 

Bill

Link to comment
Share on other sites

Hi Chip,

 

I have posted my results both as a project and a small quicktime test. They are at the same ftp link as above.

 

While I was using the falloff, I was finding that it was insufficient to stop the gravity objects from moving beyond the intended limits. I was unable to get any linkage limits to function also. I ended up resorting to putting each visualization object inside a sphere and using collision to act as my limit. This is what seemed to solve the main issue.

 

I also found that my original linkage hierarchy was causinhg issues. As a result you will find that things are linked differently now. Some of the functions were acting in unexpected ways and this change in the linkage seemed to solve some of that.

 

I would have liked some of the motion to taper off slowly, as opposed to colliding with the inside of a sphere, but this will probably do unless your solution produces better results. I should also place a collision object around the visible sphere so that the objects do not pass into it, but theat is icing on the cake.

 

I did build this up  to a full 3d scene as in the quicktime. I wanted to post the full 3D array. The project file was over 500 megs though. I trimmed it to a single plane for the EIAS file that I posted and it is down to 100 megs now.

 

See what you think . Looking forward to seeing your solution to this.

 

Bill

Link to comment
Share on other sites

Hi Bill -

 

I didn't expand my particle field as far as you did, but got similar results.  I sent a Quicktime movie to Tomas, because I can't seem to upload anything to the forum (I keep getting errors).  Tomas - I'll re-send my short movie to you.  Would you please add it to this thread for Bill to see?  Thanks!  Chip  

Link to comment
Share on other sites

Hi Bill –

 

       Finally got a chance to look at your file.  Wow…, most impressive undertaking!  At first I too thought that each gravity element needed it’s own force and limits.  As it turns out, you can do it all with just one force.  With the Igors help, I realized that forces are universal (like controlled gravity) and a single force can act on any number of objects.  I’ve expanded my Gravity Wave project into a Gravity Tube (see attached).  It’s dead simple to just keep adding more and more spheres (or cubes), and have the same global force act on them.  All I did was duplicate a selection of gravity spheres, unchecked their animation channels (to clear out the previous values calculated by Bullet), and re-check them.  Then I added the repositioned duplicated spheres to all the required Sets, and the simulation used them perfectly.

 

       Note that to return an object to it’s original position in space after being perturbed, you set it to attract itself (Page 880 of the Animator Manual “Target Set†and “Applied to Set†are the same).  I didn’t know this until I stumbled onto it in the manual.

 

       Check out how the sets are composed in Gravity Tube, and I think you can create your Gravity Distortion Grid with a lot fewer elements, and just one force.  That should help your file size, and Bullet calculation times.

 

       Good luck – you’re on an ambitious path, but I believe Bullet and EI can easily handle it!

 

Chip 

 

(P.S.  If there's no attachment, then I failed to upload it - again!!  If that happens, I'll forward it to Tomas and see if he can post it for you.  The project file is there, and a short Quicktime movie.)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...