Quantcast
Channel: Latest Questions by chintan_shroff
Viewing all articles
Browse latest Browse all 19

Lerp Camera between 2 moving points on a defined path

$
0
0
Hi all, I have been really struggling with my camera movement and need some help! The whole square rotates clockwise around **Point R** when player presses the Right key The square can be rotated infinite amount of time and I want the camera to move as if it has gravity if the square rotates 90 deg, cam moves from Point A to B (smoothly) if the square rotates 270 deg, cam moves from Point B to A (smoothly) Here is an image to explain better https://www.facebook.com/photo.php?fbid=10158179885810352&set=gm.1576462965749920&type=3&theater I have already tried moveTowards but the camera goes completely wild and doesn't move in a straight line that I have defined. void MoveClockWise() { //this rotates the entire square mySquare.transform.RotateAround(R.position, new Vector3(0.0f, 0.0f, 1.0f), -100 * Time.deltaTime); //set the step, not sure if the calculation is correct :( float step = mySpeed*Time.deltaTime; //and move camera myCamera.transform.position = Vector3.MoveTowards(myCamera.transform.position, PointB.position, step); } Any help would be appreciated. Thanks!

Viewing all articles
Browse latest Browse all 19

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>