سؤال

Similar to my recent question only this time I would like to move the object towards a vector and not another object.

Vector3 line = dalekList[i].direction;
float rotationDal = (float)(-Math.Atan2(dalekList[i].position.X, -dalekList[i].position.Z) / (2 * Math.PI));

Matrix dalekTransform = Matrix.CreateScale(GameConstants.DalekScalar) * Matrix.CreateRotationY(rotationDal) * Matrix.CreateTranslation(dalekList[i].position);

So I would need to put the rotation (rotationDal) into the CreateRotationY, only I'm not sure how to calculate that angle.

هل كانت مفيدة؟

المحلول

If the vector you want to "watch" is dalekList[i].direction, you should try to use Atan2 on it, instead of position.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top