- Home /
GameObject uses his "own" Transform
Ive made a game where you can split a sprite in half. After the split every sprite gets their own pivot point BUT when using code like transform.position, it still uses the transform of the old WHOLE sprite. (Look on the attached pictures for a better understanding.
Picture1: Here you can see the Sprite as a whole (Uses the right pivot - is perfectly aligned at x=0 y=0)
Picture2: Here you can see one of the split up parts using its own Pivot BUT as you can see the Pivot is not on x=0, y=0 but it still says that it is there in the Inspector for some reason.
Have you checked that the "tool handle position" is not set on "center" ins$$anonymous$$d of "pivot", so the handle shows there but the actual transform is at 0,0,0?
The thing is I want it to be in the center but with the corrent transform position. As you can see on the 2nd picture the pivot is cleary not on x=0, y=0;
Yes, but that would be the explanation to why the transform is not acting the way you think it would and lead to a solution.
If the pivot position is the problem, and you are using "Sprite.Create()" to create the new one, there is an overload to that function that takes a Vector2 parameter to define the pivot.
Providing the code you are having trouble with would help us help you debug it.
Your answer
Follow this Question
Related Questions
Move gameObject with mouse 1 Answer
How do i move an object relative to another objects axis. 2 Answers
Confuse about transform.InverseTransformPoint 1 Answer
Unity Camera and transform? 1 Answer