- Home /
One object move and collide then jump up to other object...
in my game two objects one is fixed and one objects is moving with learp,when this two object collide with each other, then moved object jumped up to fixed object height. How to solve this problem please help me....
You'll have to provide a clearer description of what you are trying to accomplish. One possible solution is to turn on the is$$anonymous$$inematic property in the Rigidbody of the fixed object.
how to find fixed objects height?? Using this height jumped moving object.....
Answer by iwaldrop · Jan 22, 2013 at 06:43 AM
Getting the height (I'm assuming you mean y axis for 'height' here) of any gameObject that one is colliding with is easy.
void OnCollision(Collision other)
{
float height = other.transform.position.y;
}
But it's entirely possible I'm not understanding the question...now that I think about it, you might also be referring to it's collider's bounds; which would be
void OnCollision(Collision other)
{
float height = other.collider.bounds.extents.y; // multiply by 2 for total collider height
}
In my game one object like ladder, but all ladders height are different then how to detect and jump on ladder????
Well, the second of the two examples seems like what you're looking for then. Try it and report back what you discover!
Your answer
Follow this Question
Related Questions
Jump on collision problem 0 Answers
If Grounded 2 Answers
Marble refuses to jump sometimes 3 Answers
Hold space longer = Longer jumps? 1 Answer
Jumping Problem? 3 Answers