- Home /
How to create a continuous link (growing cylinder) of instantiated models around a cylinder? (Vine growing up a tree)
The game is a vine growing up a tree. We are using a basic object instantiating script to spawn a part of the vine every x seconds.
public float waitTime = 3f;
public float timer = 1f;
public GameObject player;
public GameObject item;
void Update()
{
if (timer > 0)
{
timer -= 1 * Time.deltaTime;
//print(timer);
}
if (timer<= 0 & player.GetComponent<PlayerMovement>().isMoving)
{
Instantiate(item, this.transform.position, Quaternion.identity);
timer = waitTime;
}
}
How can we get each instantiated model to match the heading direction and rotation of the player (like a vine)? Or is their an alternate method to approach this issue?
Note: Movement as of now is forced transform of the player, but plan for it to be gravity and rigid body based
Here is a gif of the player spawning game objects as it moves along a cylinder:
Your answer
Follow this Question
Related Questions
Rotation math question: car movement on a cylinder 0 Answers
I'm having trouble clamping the rotation of the camera? 0 Answers
Calculate rotation angle for two side of cube ( like dice ) from Quaternion.identity 0 Answers
calculating looking angle between 2 transforms 0 Answers
Look at like rotating around y axis 1 Answer