Lag in Solver with Vex
1980 5 0-
- bradonwebb
- Member
- 5 posts
- Joined: June 2017
- Offline
-
- bradonwebb
- Member
- 5 posts
- Joined: June 2017
- Offline
float dist;
vector newPos = point(1,“P”,@ptnum);
vector direction = newPos - @P;
float mag = abs(distance(@P,newPos));
something like this:
query the previous and the current frame. Now that we have the “mag” distance the point has moved between the previous frame and the current frame we should be able to do something with it to determine if the point has moved too far. If the point has moved too far, move the newPos by factor X along the direction. This should move the point closer back to the original position, maybe in a similar way that lag works.
I'm like 90% there, I just need help getting over that last hump bump. How to use the distance to do that last part?
vector newPos = point(1,“P”,@ptnum);
vector direction = newPos - @P;
float mag = abs(distance(@P,newPos));
something like this:
query the previous and the current frame. Now that we have the “mag” distance the point has moved between the previous frame and the current frame we should be able to do something with it to determine if the point has moved too far. If the point has moved too far, move the newPos by factor X along the direction. This should move the point closer back to the original position, maybe in a similar way that lag works.
I'm like 90% there, I just need help getting over that last hump bump. How to use the distance to do that last part?
-
- patar
- Member
- 280 posts
- Joined:
- Offline
-
- mestela
- Member
- 1750 posts
- Joined: May 2006
- Online
-
- bradonwebb
- Member
- 5 posts
- Joined: June 2017
- Offline
Thanks! Great example I learned a lot.
If I wanted the points to 100% follow their goal, it seems like just disabling the popdrag would do it, but its creating some odd results. I think because the steerseek is using “force” not “velocity” after the point position is updated for the frame in the solver, there is residual force from the current frame to the next frame?
Maybe some kind of wrangle to kill the force or velocity after the point has been updated?
If I wanted the points to 100% follow their goal, it seems like just disabling the popdrag would do it, but its creating some odd results. I think because the steerseek is using “force” not “velocity” after the point position is updated for the frame in the solver, there is residual force from the current frame to the next frame?
Maybe some kind of wrangle to kill the force or velocity after the point has been updated?
-
- bradonwebb
- Member
- 5 posts
- Joined: June 2017
- Offline
One way to make the points follow 100% is to just set it with a pop wrangle
@P = point(0,“P”,@ptnum);
and a more manual way to do something similar to the steerseek in the pop wrangle;
@force = (point(0,“P”,@ptnum)- @P );
or
@v = (point(0,“P”,@ptnum)- @P );
More or less subtracting the current position from the new position to get the vector between them and then apply the force/velocity to the particle to move in that direction. Although in the steer seek force it looks like there is a nice breaking force so as you get closer it can scale the force down so not to overshoot the target.
Its a pretty complex problem to think about how the pop solver is going to deal with @v and @force and all the other factors of physics, mostly exuding mass at the moment.
Cool stuff!
@P = point(0,“P”,@ptnum);
and a more manual way to do something similar to the steerseek in the pop wrangle;
@force = (point(0,“P”,@ptnum)- @P );
or
@v = (point(0,“P”,@ptnum)- @P );
More or less subtracting the current position from the new position to get the vector between them and then apply the force/velocity to the particle to move in that direction. Although in the steer seek force it looks like there is a nice breaking force so as you get closer it can scale the force down so not to overshoot the target.
Its a pretty complex problem to think about how the pop solver is going to deal with @v and @force and all the other factors of physics, mostly exuding mass at the moment.
Cool stuff!
Edited by bradonwebb - Aug. 19, 2017 12:29:00
-
- Quick Links