- Home /
Get transform of instantiated Prefab; Help appreciated.
Hi everyone,
I have a small problem I can't seem to deal with. I am trying to destroy a plane/player object and instantiate a dead' camera smoothly looking at the crash site. The problem is that the target of the camera is a prefab (the wreck of the plane) and the camera will look at the prefab position when it was created (0, 0, 0) not where the prefab is actually instantiated.
This is the code to instantiate both the prefab and the camera...
I wonder if placing a camera in the wreck prefab would work? I'll do that just now :)
function Die () {
var planeWreckClone = Instantiate(planeWreck, transform.position, transform.rotation); var deadCamera = Instantiate(deadCamera, transform.position, transform.rotation);
Destroy(gameObject); }
Thanks in advance!
Answer by CallToAdventure · Nov 23, 2010 at 09:35 AM
I wonder if placing a camera in the wreck prefab would work? I'll do that just now :)
Well, what do you know. It worked :)
phew; artist should not code.
Your answer
Follow this Question
Related Questions
Howto set main.camera as a parent when main.camera itself is a child of a prefab 1 Answer
Putting prefab into scene messes with the transform origin? 1 Answer
How do I duplicate an object to work with a shootemup 0 Answers
Instantiated Object looses prefab's rotation 10 Answers
How to follow multiple clones positions of an instantiate prefab having a velocity ? 1 Answer