Question by
jelmander · Oct 11, 2016 at 06:52 PM ·
gameobjectrigidbodyvelocity
Accessing the rigidbody of a cloned Object?
What I'm trying to do is teleporting an instance of my GameObject. THis works, but when it is teleported its velocity is reset. What I'm trying to do now is acces the clone of the gameObject and find its rigidbody component to adjust its velocity. Anyone have any ideas? Here's my current code, using Unity 5.4:
void OnTriggerEnter(Collider other) { Object clone = Instantiate(other, newPosition, currRotation); clone.GetComponent<Rigidbody>().velocity = currVelocity; }
Comment
Answer by richardgengle · Oct 13, 2020 at 11:02 AM
you need to make the clone an array, then access the [ith] item