- Home /
How to drag a cube in orthographic camera?
Hi, I am trying to create a isometric game like clash of clans. I created a Terrain and I set my camera position to (0,300,-10) and Rotation to (40,45,0) and Perspective to Orthographic. I am using below code to drag a cube but when i drag the cube at some position cube is not able to visible or only some portion of cube is visible. It seems like position (X,Y,Z) all three are changing using below code. But i want to drag cube just like any top down game like Clash of Clans. Please help me to resolve my issue.
void OnMouseDrag ()
{
Vector3 mousePosition = new Vector3 (Input.mousePosition.x, Input.mousePosition.y, 0);
Vector3 objPosition = Camera.main.ScreenToWorldPoint (mousePosition);
this.target.transform.position = objPosition;
}
Your answer
Follow this Question
Related Questions
Drag and Drop lagging behind mouse 0 Answers
Drag-and-drop gameObject inversely proportional to mouse speed? 0 Answers
Drag and Drop on RTS camera 1 Answer
Drag Item Scaling on Phone 0 Answers
Isometric + Orthographic Player Movement 0 Answers