- Home /
Apply ridged body to game object when clicked.
I have an object I want to stay in one spot until clicked on. When the object is clicked on I want it to simply fall to the ground.
I'm pretty sure it's possible to do this through code. However, I only have very little programming experience. I would greatly appreciate any help.
Answer by syclamoth · Apr 03, 2012 at 11:30 PM
It's possible to do almost anything with code.
In this case, you should put the rigidbodies on the objects to begin with, and set them to 'kinematic' so that they don't respond to physics.
Then, after raycasting to their position (look it up in the scripting reference, I shouldn't have to explain something this basic), set the hit rigidbody.isKinematic to false- allowing it to fall.
is$$anonymous$$inematic
is an odd one -- it seems much more natural to enable or disable the RB (but that doesn't work as well) -- and the values seem backwards -- "kinematics" is an army term for lots of stuff flying around, so why does is$$anonymous$$inematic
mean frozen?
But, about the coding, yeah. No one asks, "I can't use photoshop, but can you give me some tips on drawing a realistic tiger?" because the advice is obviously to learn photoshop. And program$$anonymous$$g is more difficult than that.
I disagree- program$$anonymous$$g is much easier than drawing a realistic tiger. I couldn't even hope to draw a shitty tiger, let alone a realistic one!