Hm, I'm probably terrible with explaining it in words. I think a step-by-step picture can help show what I did.
http://i45.tinypic.com/2zgx4kg.png 1. I build the lines by using the velocity vectors, the positions for their origin. 2. Then find the intersection point between these two lines and use that point as the curvature centre. 3. Find the shortest angle between the two lines. 4. Transform current position and velocity vectors by the angle difference. 5. Move this new predicted position forwards by the velocity. (You had some good calculations up there for the acceleration and such) I had messed up the blog article a bit because I tried to explain two different ideas all at once. One, the theoretical algorithm for prediction of the future position. Two, the idea for efficiency of pre-computing this future position for one second ahead when a new position update message came from the simulator/server and using this by just simply linearly interpolation between current position and future position with dt (instead of re-computing the entire algorithm at each render frame). (Best to stay on list, we might help fix any other misunderstandings of people looking here, any progress/work to improve on the prediction works in favour of everyone here, activity is pretty low anyways on-list) - Nexii On Sat, Feb 6, 2010 at 5:13 AM, Celierra Darling <celie...@gmail.com> wrote: > I made a small mistake at the "current angle" (it should be -0.2ish radians > instead of -pi/4), which makes the angle difference close to a semicircle. > But still, if you add that, you end up with a vector pointing up and > backwards... (If you subtract, you end up just heading back left...) > > Maybe I'm just not interpreting what you mean by the "twist" correctly? > (Even when I 'visually' do it to your picture, I get the same result...) > Am I supposed to be finding the angle between the velocity vectors, or the > angle between the (position - intersection point) vectors? > > (We might want to work things out off-list, unless anyone would like to see > those details.) > > Celi > . > > On Fri, Feb 5, 2010 at 10:22 PM, Nexii Malthus <nex...@googlemail.com>wrote: > >> Ah, thanks Celierra. 3 planes, yes that makes a lot more sense. >> >> Hmm, trying to step through your calculations. I think you have to >> subtract the angle difference rather than add it on. >> I just tried visually going through your calcs and it seems to hit right >> on your perfect value p3. >> >> http://i48.tinypic.com/15x2wz8.png >> >> - Nexii >> >> >> >> On Sat, Feb 6, 2010 at 1:28 AM, Celierra Darling <celie...@gmail.com> >> wrote: >> > I'm not sure about this -- I tried this with a free-flight parabola and >> got >> > a nonsense value out. Calculations attached at the end. >> > What is the significance of the "anchor"? It looks like you're trying >> to >> > estimate the center of the path's curvature? If you were doing that, >> you >> > want to intersect using the lines through p and *perpendicular* to v (in >> > 2D), not intersect the lines created by v. In 3D, I think you'd want to >> > intersect 3 planes, the two planes through p perpendicular to their >> > respective v and also the plane that contains both points. >> > I'm not sure how to extend that to handle torques on the object.... >> > Have you tried estimating a = (v1 - v2)/t, and extrapolating using that >> > (p_next = p_cur + v_cur*dt + 1/2*a*dt^2)? It would also extend to >> torques >> > and angular velocity using the analogous equation. (I'm sure you could >> even >> > fit a line or spline to multiple previous values of v to get something >> even >> > higher-order, if you wanted, though with diminishing returns.) >> > >> > Celi >> > The aforementioned calculation: >> > >> > dt = 0.1 >> > a = g = [0,-2] >> > initial position and velocity: >> > p1 = [0, 0] >> > v1 = [1, 0] >> > next position and velocity >> > p2 = [0.1, -0.01] >> > v2 = [1, -0.2] >> > perfect value: p3 = [0.2, -0.04] >> > lines are (p1 + s*v1) and (p2 + t*v2) >> > intersect at s = 0.05, t = -0.05, position = [0.05, 0] >> > angle change = clockwise 3pi/4 (radians) >> > current angle = -pi/4 >> > angle after "twist" = pi/2 (upwards!?) >> > (it just gets worse from here - you estimate a distance upwards, and the >> > step forward using the current velocity doesn't get you back to y=0.) >> >> >
_______________________________________________ Policies and (un)subscribe information available here: http://wiki.secondlife.com/wiki/OpenSource-Dev Please read the policies before posting to keep unmoderated posting privileges