Quantcast
Channel: Questions in topic: "merge"
Viewing all articles
Browse latest Browse all 202

how to merge object same as Parent Child ?

$
0
0
Hi, I have Object A and Object B. now i want to attached both the ojects. So i have make Object A as parent of Object B .But the problem is that if i move Object B then object A is not moving but if i move Object A then object B moves prefectly. So please any body help me ? For Drag the object i am using bellow code: void OnMouseDown () { if (isEnable) { screenPoint = Camera.main.WorldToScreenPoint (gameObject.transform.position); offset = gameObject.transform.position - Camera.main.ScreenToWorldPoint (new Vector3 (Input.mousePosition.x, Input.mousePosition.y, screenPoint.z)); } } void OnMouseDrag () { if (isEnable) { Vector3 curScreenPoint = new Vector3 (Input.mousePosition.x, Input.mousePosition.y, screenPoint.z); Vector3 curPosition = Camera.main.ScreenToWorldPoint (curScreenPoint); transform.position = curPosition; } } Thanks Yashesh.

Viewing all articles
Browse latest Browse all 202

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>