|
I am trying to make a wall that the player can NOT get past. The player moves with 32 pixels per button-press, as soon as there's collision it shouldn't be able to move any further. Below is the current code, any ideas? By the way "w == true" refers to keyboard input booleans: and lastPosition refers to: lastPosition = gameObject.transform.position; (in the Update function)
(comments are locked)
|
|
What isn't working ? Basically, in those case you want tto know the penetration when the player goes where he isn't supposed to, then reject him from that amount, with a reflection upon the normal of the wall, so it don't just freeze. If your translation amount is constant, you're probably doing the right thing.
(comments are locked)
|
|
Well, the problem is not really that the collision doesn't work. But the way it works in my method. The way I did it is as follows: 1) Press W 2) The player jumps up Vector3(0,0,0) to Vector3(0,0,0.64) 3) Collision detects there's another Collider 4) Due to collision it tells the player to move back: Vector3(0,0,-0.64) This doesn't go smooth, you can see the player move to the collision position and jump back.
(comments are locked)
|
