- Home /
How to make an object jump when it's clicked?
I have a ball and it's rolling and I want it so when I click it it jumps ? I have a script I think i have a problem with it. P.S I'm new please no hate! function OnMouseEnter() { rigidbody.AddForce(transform.y *500, ForceMode.Acceleration); }
Answer by InfiniBuzz · Jul 10, 2013 at 11:24 PM
hi
try
function OnMouseDown()
{
rigidbody.AddForce(Vector3.up * 1000, ForceMode.Impulse);
}
no still nothing maybe it's because it's moving in a downward motion?
what do you mean by nothing? nothing? Well if its moving downwards your force probably needs to be way bigger in order to compensate the downward velocity. Also, how are you moving your object?
well it's rolling down a hill sorry I forgot to mention that, my fault. But thanks I'll try that.
ok not like free fall:) is your rigidbody checked as Is$$anonymous$$inematic?
Your answer
Follow this Question
Related Questions
Make Object Disappear when no longer in frame 1 Answer
Having script accessing issues 2 Answers
Increase render distance for one object only 2 Answers
Scale Cube script Help? (In-game via mouse) 2 Answers
How to change an object material using GUI buttons 0 Answers