I have a camera moving freely in space where there are no up an down or left or right. But The camera moves up and down or left and right over it's own local axises when the user scroll finger over the screen, and it can move forward in The camera's direction no matter in which way the user scrolls it.
What I want now is that if The camera is closer than a certain distance to a sphere it should stop moving and turn to look at the sphere's center, but still keep a logic orientation according to what the camera had before looking at the center of sphere.
I have tried to use lookAt but in some cases it flips around leaving the user in lost of control over where he is anymore.
I have also tried to add a dummy to the center of the sphere and a Child object to that and translated it to the distance that I wanted, but to be able to place the camera on that dymmy position I first need to rotate the dummy rig so that the child dummy is where the camera is. But then I dont know how to rotate the parent dummy so that the child dymmy will be located at the point where the camera is located.
Hope someone understands my jibberish explanation because it's hard for me to explain it better.
But if you do, how can I rotate the dummy and place the camera at the child's position and orient the camera in a logic way without flipping and turning so that The user loses sense of where he is anynmore.
Thanks in advance.
What I want now is that if The camera is closer than a certain distance to a sphere it should stop moving and turn to look at the sphere's center, but still keep a logic orientation according to what the camera had before looking at the center of sphere.
I have tried to use lookAt but in some cases it flips around leaving the user in lost of control over where he is anymore.
I have also tried to add a dummy to the center of the sphere and a Child object to that and translated it to the distance that I wanted, but to be able to place the camera on that dymmy position I first need to rotate the dummy rig so that the child dummy is where the camera is. But then I dont know how to rotate the parent dummy so that the child dymmy will be located at the point where the camera is located.
Hope someone understands my jibberish explanation because it's hard for me to explain it better.
But if you do, how can I rotate the dummy and place the camera at the child's position and orient the camera in a logic way without flipping and turning so that The user loses sense of where he is anynmore.
Thanks in advance.