S
S
Sergey Panov2018-06-07 10:43:46
Game development
Sergey Panov, 2018-06-07 10:43:46

How to move the object and figure out the coordinates?

Good afternoon friends! Usually I changed the position of the object as follows: Now this number does not appear, as I understand it, because of the coordinate system. Initially, the coordinates are written in the inspector: -8.8, 84, 0 (x, y, z). After certain events, these coordinates change. I'm trying to move them back like this: But as a result, it turns out that they fall out at -1552, 13534.2, -3456. I went to the documentation, I saw TransformPoint
object.transform.position = new Vector3(5,5,0)
object.transform.position = new Vector3(-9,84,0)

object.transform.position = transform.TransformPoint(-9,84,0);

As a result, the coordinates become -5.8, -896.9999, 0. Not the values ​​that I specified. Please tell me how is it right? The object is a child, it has a Rigidbody and a Hinge Joint.
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2018-06-07
@select8

Deal with transform.positionand transform.localPosition. The fact that in the inspector is the second, the coordinates relative to the parent.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question