- Home /
Megaman Movement
So I have a block and a hero, the hero has a rigidbody and a box collider, the block has a box collider. When the hero falls down to the block (the rigidbody has useGravity on) the hero's feet go through the block slightly. Not only that but if I have the hero fall off the block and then run right into the block while falling the hero sticks onto the block for as long as you hold the right movement key. Since my hero is not the famous wall crawler spider-man this is causing me strife.
In general I'm trying to create a megaman-like movement scheme, I don't want to use the character controller if at all possible. Here is my quick code for moving the character. Originally I was trying to do it just with triggers and transforms and without rigidbodies but it wouldn't detect (if you have some suggestions on this I would be thankful).
function Update ()
{
if(Input.GetAxis("Horizontal") > 0)
{
rigidbody.velocity.x = 1;
}
if(Input.GetAxis("Horizontal") < 0)
{
rigidbody.velocity.x = -1;
}
if (Input.GetButtonDown ("Jump"))
{
rigidbody.velocity.y = 5;
}
if(Input.GetAxis("Horizontal") == 0)
{
rigidbody.velocity.x = 0;
}
}
More Info: Even if I make the block a rigidbody (kinematic) it does same feet-sink-in and cling-to-wall behavior. Thanks for your help.
Your answer
Follow this Question
Related Questions
wasd movement rigidbody no bouncing 0 Answers
2D Top-Down Movement: Transform.up and right don't change 2 Answers
2D rigidbody movement & walls 2 Answers
Make characters go through each other 1 Answer
Rigidbody Platform Character Movement 0 Answers