   Setting a vector at certain distance
  I suck at math.I want to set an objects position the same distance the camera is from another object.what I'm doing is this:quaternion qobject1.position = q * (camera.position + object2.position)is that right?   
Quote:Original post by ButabeeI suck at math.I want to set an objects position the same distance the camera is from another object.what I'm doing is this:quaternion qobject1.position = q * (camera.position + object2.position)is that right?Your problem is not well defined.You want to set the position of object A(Pa) the same distance the camera(Pc) is from object B(Pb). Distance of object A to what?Moreover, if someone tells you that John and James are separated by a distance of 2kms, knowing where John is, doesn't give you the possibility to precisely locate James(to know his position). In a 2D problem, you just know that James is on a circle that has a radius of 2kms and John is at its center. That doesn't tell you where James really is. In 3D, it becomes even more complicated.So object A is at a distance D to what? And in what direction?   ;Quote:Original post by johnstanpYour problem is not well defined.You want to set the position of object A(Pa) the same distance the camera(Pc) is from object B(Pb). Distance of object A to what?And further: Even if 1 point is given, there is still a couple of possible 2nd points that fulfil the requirement; e.g. 2 points in 1D space, the infinite many points on a circle in 2D space, the infinite many points on a sphere surface in 3D space, ...(EDIT In the meanwhile johnstanp has stated this issue, too /EDIT)Probably the translation (i.e. a distance and direction) between the camera and the "another object" is to be computed in the first step. Mathematically this is a difference vector. However, you have 2 possibilities to compute it. If you want translate the camera to another object, then you have something likecamera.pos + diff1 = another.posand solving for diff1 results indiff1 = another.pos - camera.posOn the other hand, if you want to translate the another object to the camera, you have something likeanother.pos + diff2 = camera.posand solving for diff2 results indiff2 = camera.pos - another.posIt is so that both difference vectors have the same length|diff1| == |diff2|but anti-parallel directionsdiff1 / |diff1| == -1 * diff2 / |diff2|so that in summarydiff1 == -1 * diff2After deciding which difference vector to use, you (Butabee) have to decide what to further. See the "not well defined" comments above. Do you want to translate the object by diff1, i.e.obj.pos' = obj.pos + diff1or something else?   ;  Sorry if I wasn't clear enough.What I want to do is set an object to be the same distance from the camera. But based on the vector of another object.I don't know how to describe it more than that.So if I had object1 which is at a certain distance from the camera. I want to set object2 to be at that same distance from the camera in relation to object1.So I guess I just need the distance from object 1 to the camera.And then I need to set object2s position based on that distance and object1s orientation.Hopefully that's more clear.   ;Quote:Original post by ButabeeSorry if I wasn't clear enough.What I want to do is set an object to be the same distance from the camera. But based on the vector of another object.I don't know how to describe it more than that.So if I had object1 which is at a certain distance from the camera. I want to set object2 to be at that same distance from the camera in relation to object1.So I guess I just need the distance from object 1 to the camera.And then I need to set object2s position based on that distance and object1s orientation.Hopefully that's more clear."Euh..."( translate "Huh..." )Nope.Maybe you want the vectors joining object1 to the camera and object2 to the camera, to form the same angle with a given direction( maybe a vector joining another object to the camera? )I guess your problem is two-dimensional.  It may be related to something like an angle bissector.Look at the first figure there:wikipedia-angle bissector theoremIs your camera at location A, object1 at location B, the vector that separates the two objects is AD and you want to find the location of object2, that is to say, location C?   ;  I solved it...Here's what I did.position = (q * Vector3(0,0,-(cam.Position() - object1.Position()).length()) + object1.Position);   