- Home /
Detecting collision with object what touched and making a hinge joint between.
Hello, I really need a piece of script what can help me with it. I am making builder menu for my game and I want to get script like that:
function ??? ()
{
if(Input.GetButtonUp("Jump"))
{
hingeJoint.connectedBody = //this one what touched.rigidbody;
}
}
so, what i really need is something what detect collision with Exacly this one what touched and no it can't really be OnCollisionEnter because i have to have some object named the same. Hope you will understand my question :)
Answer by Mithosbluefish · Aug 12, 2013 at 10:09 PM
Here's some info on the function OnCollisionEnter, it gives you the object you collided with when you collide with it and executes your code when the collision occurs. http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.OnCollisionEnter.html
Your answer
![](https://koobas.hobune.stream/wayback/20220613112050im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Trigger Enter and Exit not working properly? 2 Answers
Collision point on surface? 1 Answer
Ragdollize kinematic rigidbodies 0 Answers