I have a scene with objects in centre of the scene and the camera is looking at the object.
I looking for a script so I can move my ringer around on the iPad/iPhone and my objects orbit around.
When I take my finger of the screen the object stays in same rotation when I click on the screen
and start to drag the 3 objects orbit around centre.
When I click and hold on a button on the screen I activated “move mode” than when I on click 3d with a finger
I move the 3d object parallel to the camera.
Anything out there?
Uh, swipe control? http://gameassets.net/swipeControl.html
Your writing isn’t very clear.
this works for on the PC/MAC. HOw can I can this to work on the iPad?
I want when I hold down a button, i can move around my object in this same manner
var mainCamera : Camera;
private var isDragging : boolean = false;
private var distance : float;
function Start(){
mainCamera = Camera.main;
}
function Update () {
if(!Input.GetKey("m")) isDragging = false;
if(isDragging){
var ray = mainCamera.ScreenPointToRay(Input.mousePosition);
transform.position = ray.GetPoint(distance);
}
}
function OnMouseDown(){
isDragging = true;
distance = Vector3.Distance(transform.position, mainCamera.transform.position);
}
function OnMouseUp(){
isDragging = false;
}
}
For the orbiting, you might be able to use the Mouse Orbit camera script that comes with Unity (or else adapt it a bit). There is a code example in this thread that shows how to drag an object in a plane parallel to the camera.