I have a secondary camera (Cam1) added to a 3D object(obj1). So, when I click the object I want to activate the perspective camera- Cam1. It should basically look at the same direction as the object to show what lies in the object’s path. This is supposed to be shown in Inset window. Example: https://jsfiddle.net/qwb39spx/
Camera’s look along the negative z-axis by default. You have to rotate the camera around the y-axis around 180 degrees so it looks along the positive z-axis like ordinary 3D objects. Do this like so:
Cam1.rotation.y = Math.PI;
If you do this and assuming the camera is child of a 3D object, it should automatically look along the same forward vector.
I have tried this and it is still the same.
The objgroup is a group of meshed 3D objects which make a whole robot.
I have the helper activated to see where is camera is looking. Although it is a plane, sometimes it is looking half below the plane and half above and in some place, it is looking just over the place. When I move the objgroup forward, the camera moves ahead of it exponentially as well as rotates around the objgroup while going further ahead and when I move the objgroup backward, it sort of comes back.
Can you please share your current implementation as a live example? I’m afraid your fiddle does not demonstrate this wrong behavior. Sharing a git repository with your code is also a good idea.
BTW: The inset view seems totally unrelated to your real issue. This topic seems more about the proper transformation of your camera.
I think attaching the camera to the object makes it only harder to predict the behavior. Manually updating camera position and rotation with the robot movement sounds easier.
Take a look at this example. If I understood the problem correctly, this is what you are looking for.