I made a video:
I basically have a broken and unbroken model of the door. When the player collides with the door it gets deleted and spawns in the broken verision of the door. But the broken prefab spawns a bit higher and i want to offset it’s spawning position down on the y-axis. You can see the code in the video but here it is.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class doorDestruction : MonoBehaviour
{
public GameObject destroyedMode;
void OnCollisionEnter(Collision collide)
{
if (collide.gameObject.tag == "Player")
{
Instantiate(destroyedMode, transform.position, transform.rotation);
Destroy(gameObject);
}
}
}