Hi, sorry i know that the question already exists but i can find it no more :(… i have 2 raycast, pnt1 and pnt2 are the contact point… i want the angle between they… exact i want that an object on point 2, can face the point 1… thanks
Mauro
Hi, sorry i know that the question already exists but i can find it no more :(… i have 2 raycast, pnt1 and pnt2 are the contact point… i want the angle between they… exact i want that an object on point 2, can face the point 1… thanks
Mauro
Can you use Transform.LookAt to point your object at the other object? Not really sure what you are trying to do.
Matt.
i have 2 raycast, one in front of an object, and the second back of the object, they go from sky to down on the terrain, and iwant that the object that is in the middle of those rayacast, will face from point back to the point front… understand?
If I understand you correctly, you have a line segment made from two points that are gotten from raycasts, and you want the character to aim sort of between them? Or do you want to aim the character along the vector created by those two raycasts?
If you want to aim the character along that vector it’s pretty simple.
Subtract the “in front” vector from the “behind” vector. This’ll give you a direction. You can use that vector to aim your character. You could normalize the vector and add it to the position of your character in space, then use the lookat function, I think, or you could use the vector as the aim and the world up as the up and modify the matrix yourself.
Hope that helps!