HI. Is anyone familiar with a combination of Vuforia AR SDK and the Lean touch scripts?
I am creating a project in which I have multiple child objects of my image target. (a cube, a sphere etc.) When I try to add the transform functionality from the lean touch script it transforms all objects even though I only pick (and touch) one of them.
For those not familiar with the Lean touch script:
I have attached a touch script to an empty gameobject. Also each object that needs to be dragged has a draggable and transform script attached. BUT when I touch and scale one object it affects all the other objects aswell. What To Do?
I have attached a image of the hierarchy and the inspector of one of the draggable objects
[81286-skærmbillede-2016-11-01-kl-114528.png|81286]
The transform script:
using UnityEngine;
namespace Lean.Touch
{
// This script allows you to transform the current GameObject
public class LeanTransform : MonoBehaviour
{
public bool AllowTranslate = true;
public bool AllowRotate = true;
public bool AllowScale = true;
protected virtual void Update()
{
if (AllowTranslate == true)
{
Translate(LeanTouch.DragDelta);
}
if (AllowRotate == true)
{
Rotate(LeanTouch.TwistDegrees);
}
if (AllowScale == true)
{
Scale(LeanTouch.PinchScale);
}
}
private void Translate(Vector2 screenPositionDelta)
{
// Screen position of the transform
var screenPosition = Camera.main.WorldToScreenPoint(transform.position);
// Add the deltaPosition
screenPosition += (Vector3)screenPositionDelta;
// Convert back to world space
transform.position = Camera.main.ScreenToWorldPoint(screenPosition);
}
private void Rotate(float angleDelta)
{
transform.rotation *= Quaternion.Euler(0.0f, 0.0f, angleDelta);
}
private void Scale(float scale)
{
// Make sure the scale is valid
if (scale > 0.0f)
{
// Grow the local scale by scale
transform.localScale *= scale;
}
}
}
}
Dude. You create your tilemap with Tiled and then import it into Unity with Tiled2Unity. Where's the problem with that?
– Cherno