miguelvfx Posted May 3, 2012 Share Posted May 3, 2012 (edited) Hello, I'm trying to compute acceleration from specified velocity, distance and time. The idea is to simulate points or particles to hit an exact destination within the given time. Right now, the initial model (to test the equations) I have only works when time is set to 4. Other numbers return unexpected acceleration values. The distance equation I used is: distance = ( velocity * time ) + ( 1/2 * acceleration * time ^ 2 ) Here's what I came up with: acceleration = (-velocity * time - distance ) / ( (1/2) * time^2 ) ( (-1) * ch("./viewVel") ) - ch("./timeToDest") / ( (1/2) * ( ch("./timeToDest") * ch("./timeToDest") ) ) The file is attached. The scene is of two points apart, popnet to generate a particle with velocity. All expressions are in the null_control node. My questions are... Is my translation from the equation to parameter expression correct? Am I using the correct nodes to set velocity and acceleration? And.. Is my algebra correct? I would appreciate any form of help. Thank you very much! acceleration_test.hipnc Edited May 3, 2012 by miguelvfx Quote Link to comment Share on other sites More sharing options...
miguelvfx Posted May 3, 2012 Author Share Posted May 3, 2012 Here's the hipnc file. Thanks for the help. acceleration_test.hipnc Quote Link to comment Share on other sites More sharing options...
Darric Posted May 4, 2012 Share Posted May 4, 2012 (edited) There are a few problems here ... First, the derivation in your image is incorrect, in the last step you're multiplying both sides by -1, but "vt-d" incorrectly becomes "-vt-d" instead of "-vt+d", or simpler, "d-vt". The correct form of the equation is: a = (d-vt)/(0.5 * t^2) But even that is a little unwieldy, if you shuffle the terms a little bit you end up with: a = 2 * ((d-vt) / (t^2)) Your expression was: ( (-1) * ch("./viewVel") ) - ch("./timeToDest") / ( (1/2) * ( ch("./timeToDest") * ch("./timeToDest") ) ) ... which doesn't even match your derivation, it's missing distance on the left and is bracketed badly (BODMAS!), so in all you're not getting nearly the result you want. Worse yet, your acceleration node isn't even hooked up to your accelerationAccess channel (it's looking for "null1" instead of "null_controls"). A correct expression based on my earlier derivation is: 2 * ( ch("./measureDistance") - ( ch("./viewVel") * ch("./timeToDest") ) ) / ( ( ch("./timeToDest") * ch("./timeToDest") ) ) I gave it a few tests, and it seems to work fine for different time values ... ... except this probably isn't going to work how you expect it to for some velocities. The mechanics equation doesn't account for the fact that you (probably) want zero velocity as the particles approach the goal, so what ends up happening for high enough initial velocity (try putting your initial velocity to 10) is that the particle overshoots the goal at first, and then decelerates to return back to it at the time mark. Here's a modified version of your scene with the corrections: acceleration_test.hipnc Edited May 4, 2012 by Darric Quote Link to comment Share on other sites More sharing options...
miguelvfx Posted May 4, 2012 Author Share Posted May 4, 2012 (edited) Thanks for pointing them out, Darric. As suggested I worked on the equation first without getting caught up in the implementation. Then I addressed the reference issues. It works for I want it do right now. Here's what I end up with for the acceleration expression: ( ( 2 * ch("./measureDistance") ) / ( ch("./timeToDest") * ch("./timeToDest") ) ) - ( ( 2 * ch("./viewVel") )/ ch("./timeToDest") ) Edited May 4, 2012 by miguelvfx Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.