justin.m.chase
Reputation
Top tag
Next privilege 125 Rep.
Vote down
 Sep 10 awarded Popular Question Sep 24 awarded Autobiographer Dec 5 comment Detecting if an object is following a path Actually I think that was exactly what I needed, thanks again. Dec 5 accepted Detecting if an object is following a path Dec 5 comment Detecting if an object is following a path That is a great link though, I will have to reconsider this. Thanks. Dec 5 comment Detecting if an object is following a path Yes the points form lines, though with U-turns and looping on ramps it gets pretty interesting. I actually started out with what you were recommending but found that it had problems with U-turns, where a point further down the path might actually be closer to your current position which is actually between two earlier points. Dec 5 asked Detecting if an object is following a path Mar 30 comment Matrix rotation of a rectangle to “face” a given point in 2d In reality I'm using a rectangle, it looks good. Also a friend of mine showed me a way to do it without using trig. It's basically like this: `var p = target.subtract(new Point(x, y)).normal();` then the matrix is: `[p.y, -p.x, p.x, p.y, x, y]` Mar 30 accepted Matrix rotation of a rectangle to “face” a given point in 2d Mar 30 comment Matrix rotation of a rectangle to “face” a given point in 2d This may make me sound foolish but one revelation that I had while working on this was that `position` is not needed at all... the position information is encoded into the matrix. That was messing me up. Mar 30 awarded Scholar Mar 30 awarded Commentator Mar 30 comment Matrix rotation of a rectangle to “face” a given point in 2d Thanks a ton, this was almost exactly what I needed. I just submitted an edit to your answer with the actually working function for future reference. I will accept this as the answer. Mar 30 suggested rejected edit on Matrix rotation of a rectangle to “face” a given point in 2d Mar 30 comment Matrix rotation of a rectangle to “face” a given point in 2d Thanks for your patience everyone. I'm realizing I'm thinking about things wrong. I'm getting closer. Mar 30 awarded Student Mar 30 comment Matrix rotation of a rectangle to “face” a given point in 2d Hmm, now how the heck would I translate that into 2d? Mar 30 comment Matrix rotation of a rectangle to “face” a given point in 2d Oh yes that looks good! I'm assuming the second part of the formula is the new matrix? The formatting there is pretty unfortunate. Mar 30 comment Matrix rotation of a rectangle to “face” a given point in 2d Whatever way is eaiser to explain I think. I was picturing the identity matrix and identity vector to essentially be the direction the rectangle was "facing" in the start state... but basically I want the top side of the rectangle to be considered the direction it is facing. Mar 30 awarded Editor