Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  How to simulate Planet gravity
#2
Hi there,

Depending on how large your planet is, using a single gravity vector for the entire solver might not be a good solution. Assuming the planet is really, really large compared to the solver, you can use the same gravity for all particles in the solver.

The solver is just a regular GameObject, so you get its position the usual way:

Code:
var pos = solver.transform.position;

To set its gravity, you do:

Quote:solver.parameters.gravity = yourGravity;
solver.PushSolverParameters();

See the API docs for details.

However if your planet is small enough, using the same gravity for all particles won't do. Each individual particle in the solver must have its own gravity vector, since you can't assume all gravity vectors are close to parallel to each other.

In this case, the best solution is to set the global solver's gravity to zero, and apply your own gravity to each particle as an external acceleration. You do this by writing into the solver's velocities array. See:
http://obi.virtualmethodstudio.com/manua...icles.html
Reply


Messages In This Thread
How to simulate Planet gravity - by wushuaiqi - 27-10-2021, 10:28 AM
RE: How to simulate Planet gravity - by josemendez - 27-10-2021, 10:37 AM
RE: How to simulate Planet gravity - by wushuaiqi - 27-10-2021, 10:52 AM
RE: How to simulate Planet gravity - by wushuaiqi - 27-10-2021, 11:15 AM
RE: How to simulate Planet gravity - by wushuaiqi - 27-10-2021, 11:18 AM
RE: How to simulate Planet gravity - by wushuaiqi - 27-10-2021, 11:26 AM