- Home /
Collider's Related Transform Component
How do I link to a Collider's related Transform component in a JavaScript? If for some reason I can't, how can I alter an object's coordinates when a collision has been detected?
Can you describe more what you are trying to do? You can change an objects coordinates by modifying its Transform.position (which you would access with something like 'collision.transform.position' inside of OnCollisionEnter()), but I'm guessing there is more here.
Answer by GameSlayerGS · Apr 24, 2013 at 04:13 PM
My goal is to direct an object to move down, by decreasing the y value of transform.position when the object comes into contact with another. The stationary object that the moving object comes into contact with contains the script, I have my collision detector in the trigger, using OnTriggerEnter. OnTriggerEnter(other : Collider) //other is the object that should get moved down. Anyways... I figured it out. I was trying to have the move command be in a different function and that just wasn't working, I'll just do it in the OnTriggerEnter function, that's working fine and should simplify the next bit.
Your answer
Follow this Question
Related Questions
Having trouble understanding parenting with componants 0 Answers
Stop moving when colliding. 2D 1 Answer
Multiple Colliders With Mechanim 1 Answer
How to properly move a rigidbody/collider? 2 Answers
can not move my enemy with rigidbody 1 Answer