Copy collision object position (Or just "fly" a little bit)
Well, sorry about the title, im not pretty sure how to tell it right, i have been looking for a while (Maybe 1 day?) and i cant seem to find something usefull, The image speaks for itself:
http://i.imgur.com/Uz3CVQD.png
void OnCollisionStay(Collision col)
{
if(col.gameObject.tag == "StageCol")
{
if (jumpSpeed<0)
{canjump=true;
jumping=false;
jumpSpeed=0;
//transform.position+=new Vector3(0f,0.1f,0f);
//transform.position.y = col.transform.position.y;
}}
}
Is pretty simple, The problem is that it get stuck, i can apply simple logic to why its happening, but i cant seem to find the code that i need, here is my ideas:
-Copy other (Platform) y position to stay on top of it.
or
-Move the character y position a lot of times till it stays on top of the ground. (I like this one, but it seems "harder")
Any help will be apreciated, I started with Unity few days ago (I learned a lot of stuff about Game Maker, so... i have "ideas" on how to do the things but the codes are way different and i cant find a way to do it u.u)
Your answer
Follow this Question
Related Questions
Rigidbody - How to make it jump and fall down fast ? Help needed. 1 Answer
oncollisionexit not working 1 Answer
Bounce, gravity and velocity 1 Answer
Sphere bouncing back on edges of aligned objects 0 Answers
Restrict held object movement 0 Answers