I have player with next properties:
Player move code fragment:
if (isMoveLeft)
{
var angle = transform.eulerAngles.z+this.turnSpeed ;
float yAngle = Mathf.LerpAngle(transform.eulerAngles.z, angle, this.rigidbody.velocity.magnitude * Time.deltaTime );
var rotation = Quaternion.Euler( 0, transform.eulerAngles.y,yAngle );
rigidbody.MoveRotation( rotation);
}
this.rigidbody.velocity = this.transform.up * flyingSpeed* Time.deltaTime;
And I have ‘wall’ (With box collider and physic material)
‘bounciness’ 1,
‘static friction’ 100
I cannot go thru the wall instantly - collider is working!
But if I will move in that direction for a few seconds player will go thru.
What i am doing wrong?
I want my wall to stops player and that’s it.
Something like this doesnot helps:
void OnCollisionEnter(Collision collision) {
flyingSpeed=0;
}