Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inertia effect on particle #30

Open
lo-fo opened this issue Mar 25, 2015 · 0 comments
Open

inertia effect on particle #30

lo-fo opened this issue Mar 25, 2015 · 0 comments

Comments

@lo-fo
Copy link

lo-fo commented Mar 25, 2015

How would one add an effect of inertia on a particle ?

let's say i would like to improve the example from the guide (copy/pasted here)

var mousePin = null;

renderer.on('pointerdown', function(point) {
    var particle = sim.findNearest(point, 30);
    if (particle) mousePin = sim.add(Newton.PinConstraint(particle, point));
});

renderer.on('pointerup', function(point) {
   if (!mousePin) return;
   sim.remove(mousePin);
   mousePin = null;
});

And i would like the particle to continue its movement upon mouse release, and slowly stop until its completely static.

Since forces are applied globally on all particles, the way to go would be to make an inertia constraint to target a specific particle.
Am i right ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant