Positional Correction

I have a moving capsule moving around other capsules. P_old is capsule’s current position and p_new is capsule’s predicted position in the next timestep. I know the normal vector that is perpendicular to capsule body. I want to move the capsule in a way so that it doesn’t deviate more than 𝜽 angle from the capsule’s normal in consecutive 2 timesteps. That means, I want to bring the point p_new inside green region as p_new is more than 𝜽 degree (currently 𝜶 degree with capsule normal) from the capsule normal that is perpendicular to capsule body.

I tried that in different ways but doing something wrong. Could anyone please help me with right geometrical equations here? Thank you.

Are you trying to implement steering?

Anyway, it would probably help to know how you calculate the new position, because that may orient towards a solution that works for your intended use case.

That said, I’m still new to 3D stuff as well, so I might not be able to help you in the end.

The video below shows how points are moved within the “view field” of the normal vector. Each run the positions, the directions and the angles are random. For your case you do not need to slide the points, sliding is just added to make it easy to see the final destination of each point.

Generally, the algorithm is like this:

  • if the angle to the normal vector is less than or equal to theta, then the point is good and do nothing
  • otherwise check whether the angle to w_l or w_r is smaller, and move the point on this vector, no need to rotate, w_l and w_r are already known directions
  • that’s all