Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This is my object drag, might help.. it's a .cs code attached to the game object
- void OnMouseDrag()
- {
- Vector3 curScreenPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);
- Vector3 curPosition = Camera.main.ScreenToWorldPoint(curScreenPoint) + offset;
- if (Global.noGrid[0]) //noGrid means inside the grid ('no' in Portuguese means 'in')
- {
- transform.position = Global.FindClosestObject(curPosition, "gizmo_peca").transform.position; // here i find the game closest gameobject inside the grid, i do that because i need a snap (that's why i need the trigger working to, to recognize which gameobject it's colliding
- }
- else
- {
- transform.position = new Vector3(curPosition.x, curPosition.y, curPosition.z);
- }
- }
- // This is what i tried but with no success in BlockForma.cs (It's how I call my gameobject above)
- void OnTriggerEnter2D(Collider2D c)
- {
- if (c.tag == "Forma")
- {
- c.rigidbody2D.velocity = new Vector2(0,0);
- Debug.Log("Hello");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement