This.acc = createVector(0, 0) // Acceleration This.vel = createVector(0, 0) // Velocity of object This.pos = createVector(x, y) // Reference position of object ![]() I created object "Wall", which is made of two point (A, B) and those points are used to create a linear function, and I use it to determine, whether a point is "behind it".į1: y = tg * x + Ax - Ay * tg tg = (By - Ay) / (Bx - Ax)į2: y = tn * x + Ox - Ay * tn tn = Vy / Vx ![]() My problem is, when the object touches the wall, it does bounce, but it also moves it to wrong position (mainly more to the bottom right). I am trying to make a simulation of bouncing object with set borders and angles.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |