[solved]Reciprocative repelling objects in an enclosed space

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

[solved]Reciprocative repelling objects in an enclosed space

Postby Andazeus » Tue Mar 20, 2012 11:49 am

Hello everyone!

I am currently looking for a physics engine for my ongoing Ogre3D project and Newton seems to be very well supported.

Since I am new to physics engines, I would like to know if Newton can handle the following scenario (I assume it does, but I am still somewhat overwhelmed by the documentation and having some trouble finding the clues I need):

I wish to have a big sphere which contains numerous (at least dozens, up to hundreds if reasonably manageable) small spheres. The small spheres are much smaller than the big one, so there is plenty of empty space inside it. The big sphere is stationary. The small spheres move in random directions, at random speed (within some confinements) and they change their speed and direction at random intervalls (intervalls never less than 1 second). The small spheres and their movement pattern are already implemented in Ogre3D.

The part where Newton would need to come into play:

the small spheres should repell each other. The closer they get, the stronger the force that drives them apart from each other. In order to help with performance, it does not need to be super precise. The interaction only needs to start when the distance between two spheres falls below a certain threshold and there is some flexibility on the update intervall (though the shorter, the better).
Additionally, they should interact with the big sphere in a similar way. As they get closer to the sphere's border, they should be similarly repelled by it, keeping them within the big sphere at all times.


If my description is not clear enough, I will try to make some kind of drawing later on.


Can Newton handle this scenario?
If it can: any hints on what would be the best course of action?


Thank you!
Last edited by Andazeus on Wed Mar 21, 2012 8:58 am, edited 1 time in total.
Andazeus
 
Posts: 11
Joined: Tue Mar 20, 2012 11:19 am

Re: Reciprocative repelling objects in an enclosed space

Postby Julio Jerez » Tue Mar 20, 2012 12:00 pm

basically you need to implmnet a custum forrce and turque call back and in the funtion you can call NewtopnForEachBody in AABB, and calculate all of the forces that apply to that body.

how you calculate the force in teh call back it is up to you, bu it should works without problems.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Reciprocative repelling objects in an enclosed space

Postby Andazeus » Wed Mar 21, 2012 8:58 am

Cool. Thank you for the quick response!

Time to get to work :D
Andazeus
 
Posts: 11
Joined: Tue Mar 20, 2012 11:19 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest