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.
1 Answer
1
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.
– Owen-ReynoldsisKinematicis 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 doesisKinematicmean 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 programming is more difficult than that.I disagree- programming is much easier than drawing a realistic tiger. I couldn't even hope to draw a shitty tiger, let alone a realistic one!
– syclamoth