|
Hey, I am having a little trouble with instantiating. What I started out with was attaching this script:
To the character (3rd person). I then added the "Campfire" prefab as newObject so that if you click the mouse button, it creates a campfire below you. It gave me error messages though, and when you click the mouse, the campfire was located around the character's head and rotated 90 degrees. I need it on the ground. Does somebody know how I can fix this script to get it to work? Thanks!
(comments are locked)
|
|
Vector3(0,0,0) in your example should be Quaternion.identity After that, you should just be able to play around with the first vector to set the right height Okay, I changed it as you suggested. But now it places the Campfire in the middle of the map, not where the character is. Thanks again!
Jul 22 '10 at 08:40 PM
MythStrott
change the vector to (transform.position - Vector3.up), that'll put it one meter below the character's position (you can play with it from there)
Jul 22 '10 at 09:09 PM
Mike 3
I'm not sure if this is right so in a comment but try Instantiate(newObject, transform.position, transform.rotation); And attach the script to the character so that it will instantiate on player. Then you can modify a little by ignoring collision and such. Hope it works/helps :P ! If works give points to Mike (I owe him anyways) :P
Jul 22 '10 at 09:14 PM
MikezNesh
oh well beaten by Mike.
Jul 22 '10 at 09:14 PM
MikezNesh
I got it to work. Thanks!
Jul 23 '10 at 04:19 AM
MythStrott
(comments are locked)
|
