Problem is not reproducible or outdated
why when putting a cube prefab as a child of another moving object it change the cubes scale !!!
hi im making a game like crossy road and now im making the platforms over the water
so to make it im making over every moving platform cubes makin them "istrigger" to attract the player and put it in the right position so the script works when it is not a child of another gameobject but if it is a child the script dont works
the script is this ::
using UnityEngine;
public class plat_to_ground : MonoBehaviour {
private GameObject player;
void Start()
{
player = GameObject.FindGameObjectWithTag ("Player");
}
void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "Player")
{
player.transform.position = new Vector3(transform.position.x,player.transform.position.y,transform.position.z);
Destroy (gameObject, 1);
}
}
}
Follow this Question
Related Questions
Trying to Generate Different Random Values for Position of Game Object Instances [C#] 1 Answer
Terrain height -> loosing Players GO childs 0 Answers
Need help with multiple updating transform positions 2 Answers
How would someone go about creating multiple triggers in one script 0 Answers
Need help with this code? thanks. 2 Answers