how can i control scale speed ?
i am trying to build customizable house where you can customize the house , and in this code below you can move walls in the opposite direction, and when you move walls the ground scale with it , but the ground scale faster than it should be or larger than it should be
as you see in the ex-images the scaling of the roof is larger and the ground is smaller
also i have the same problem with the back wall
i am using this code :
using UnityEngine;
using System.Collections;
public class leftWall: MonoBehaviour {
private Vector3 screenPoint;
private Vector3 offset;
public GameObject rightWall;
public GameObject ground;
public GameObject roof;
public Vector3 pos;
public Vector3 scale;
public Vector3 scaleroof;
public float speed = 0f;
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;
rightWall.transform.position = -cursorPosition-pos;
ground.transform.localScale = cursorPosition-scale;
roof.transform.localScale = cursorPosition-scaleroof;
}
}
if any one want to help and have problem understanding me , please let me know
thank you a lot
Answer by tormentoarmagedoom · May 07, 2018 at 03:14 PM
Good day.
Modifying transofrm.scale property is not a good idea if they are not exatly the same proportions... I don'tknow exactly whay happens, but is a bad idea.. :(
sry for not really help :D
bye