- Home /
How can I have 2 transforms have the same position and rotation
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Position : MonoBehaviour
{
[SerializeField]
Transform obj1;
[SerializeField]
Transform obj2;
// Update is called once per frame
void Update()
{
obj1.position = obj2.position;
obj1.rotation = obj2.rotation;
}
}
I would like to make a script that has the same effect as the script uptop but better and I don't want to make obj1 to be a child of obj2 just have the same rotation and position, because the script uptop has like this side effect that makes obj1 slide in place(not what I want). I want an effect that it actually locks in place, but if its not possible then its ok thx for the help.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612235456im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Position and rotate 3 sprites perpendicular to the edges of a triangle 1 Answer
transform.forward doesn't work in my code 3 Answers
An Efficient Way To Follow Transform's Position? 3 Answers
Flip over an object (smooth transition) 3 Answers
How to make Camera position Independent of its Rotation? 1 Answer