- Home /
Spawned Object spawning to low.
Solved my own issue wont allow me to delete.
Answer by clunk47 · Jun 12, 2013 at 08:26 PM
just change the Y value in spawn.position, or do something like spawn.position + Vector3.up
What would be the best way to change the y value I think this is what I am needing to do I just have to take the current one and add just a bit to it to make it higher?
Yes. spawn.position = new Vector3(0, 1, 0) for example, you would change to Vector3(0, 2, 0)...
That's making the object spawn at a specific location. What I am looking at is trying to make the object spawn where the character is even if he moves around. Like a mount. Right now with the coding I provided at the top it is spawning at his location all the time but its spawning so that when you try to move it has to raise to be able to move.
Yeah, that's an example. If you need specifics either post your code or do some more homework on instantiating. If you say have this script attached to your character, you would instantiate @ transform.position. You should really just edit your question and add in the scripts you are using, and tell us what each script is attached to.
Answer by bubzy · Jun 12, 2013 at 08:44 PM
position is a vector3(x,y,z)
if you want to increment one value you can add a value to it, as clunk said
maybe
Vector3 higherSpawn = spawn.position + new Vector3(0,yourValHere,0);
GameObject clone = Instantiate(prefabToSpawn,higherSpawn, spawn.rotation)as GameObject;
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
c# enemy's not spawning 1 Answer
Procedural Spawning Theorems 0 Answers
Spawn 1 Enemy In 1 of 4 Spawnpoints and then Randomly Respawn 2 Answers