- Home /
camera move(slide) continiously on IOS
I can move my camera around with two fingers, when I release my two fingers, camera permanently stops moving. Is it possible, after finger release, to do an ice move, like camera would continue move with cool-down effect (slowing down)? ( Or even while you moving camera, camera would do a drifting effect (like wiggle)?)
Here is my current script
var X = ((Input.GetTouch(0).deltaPosition.x+Input.GetTouch(1).deltaPosition.x));
var Z = ((Input.GetTouch(0).deltaPosition.y+Input.GetTouch(1).deltaPosition.y));
var multiply = camera.orthographicSize*0.0017;
camera.transform.position-=Vector3(X*multiply,0,Z*multiply);
Answer by AlucardJay · Jul 19, 2012 at 06:38 AM
Instead of directly placing the object using transform.position , tell the object where to go with lerp :
http://docs.unity3d.com/Documentation/ScriptReference/Vector3.Lerp.html
replace camera.transform.position-=Vector3(X*multiply,0,Z*multiply);
with :
var moveSpeed : float = 5.0;
camera.transform.position = Vector3.Lerp( transform.position, ( transform.position - Vector3(X * multiply, 0, Z * multiply) ), Time.deltaTime * moveSpeed );
Your answer
Follow this Question
Related Questions
Move Camera Over Terrain Using Touch Input 2 Answers
How to move the camera depending on the score? 1 Answer
Moving two objects and avoiding overlap with each other 1 Answer
Native camera FOV? 0 Answers
3rd person player 0 Answers