- Home /
how to control scale speed ?
i want to control scale speed , i contacted to object toghather , when i moving an object the other object is scaling but the scale is faster than move i want how can i make float speed for it
here is the code :
using UnityEngine;
using System.Collections;
public class rightWall: MonoBehaviour {
private Vector3 screenPoint;
private Vector3 offset;
public GameObject leftWall;
public GameObject ground;
public GameObject roof;
public Vector3 pos;
public Vector3 scale;
public Vector3 scaleroof;
void OnMouseDown(){
screenPoint = Camera.main.WorldToScreenPoint(gameObject.transform.position);
offset = gameObject.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, 0, screenPoint.z));
}
void OnMouseDrag(){
Vector3 cursorPoint = new Vector3(Input.mousePosition.x, 0, screenPoint.z);
Vector3 cursorPosition = Camera.main.ScreenToWorldPoint(cursorPoint) + offset;
transform.position = cursorPosition;
leftWall.transform.position = -cursorPosition-pos;
ground.transform.localScale = cursorPosition-scale;
roof.transform.localScale = cursorPosition-scaleroof;
}
}
Comment
Yeah I am also very confused. Can you take the time to make the question understandable please.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
A real head-scratcher 0 Answers
Object from list in scriptableobject in list 0 Answers
How to make buttons have sound when it is highlighted and clicked? 0 Answers