- Home /
Question by
Guille_b · Jul 15, 2015 at 10:53 AM ·
rotationinstantiateprefabobject
Problem with instantiate rotation
Hi Everybody!!
I have the next problem:
I have two characters on a object which rotates around "target". Everything it's fine.
The problem is...
When the Character B throw a prefab ball to the character A the object never reach "target1" it lost in the infinite space...
This is the code that I actually using for it...
private Animator anim;
public Transform target;
public Transform outzone;
public float velocidad;
public float timeDelay = 3.0f;
private float timestamp;
public Rigidbody object;
void Start () {
anim = this.GetComponent <Animator> ();
timestamp = 6f;
}
void Update () {
anim.SetTrigger ("Throw");
timestamp += timeDelay;
}
}
public void Throw (){
Rigidbody shootInstantiate;
shootInstantiate = Instantiate (object, outzone.position, outzone.rotation) as Rigidbody;
disparosInstantiate.transform.LookAt (target);
disparosInstantiate.AddForce (target.position * speed);
disparosInstantiate.transform.parent = gameObject.transform;
Character A and B are "children" of the big object...
Please help!!
sin-titulo.png
(57.5 kB)
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220611231332im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Instantiating Objects on the Sides of Other Objects 1 Answer
Multiple timers on server as objects or prefabs? 0 Answers
Unespected rotation for Instantiate object 1 Answer
Preventing parts of a prefab from rotating w/parent? 0 Answers
how do I keep each cloned object at a certain point after trigger 0 Answers