Hello Everybody,
iam using some code from the Example 2D Plattformer Project to handle my PlayerCollision - for checking if iam on the ground or hit an enemy.
grounded = Physics2D.Linecast(transform.position, groundCheck.position, 1 << LayerMask.NameToLayer("Ground"));
hitEnemy = Physics2D.Linecast(transform.position, groundCheck.position, 1 << LayerMask.NameToLayer("Enemy"));
My Question about that is: Why i cant use
“LayerMask.NameToLayer(“Enemy”)”
instead of
“1 << LayerMask.NameToLayer(“Enemy”)”.
What is the difference about “1 <<” ? I do not know what this operator doing here exactly.
Would be nice if somebody could explain me that.
best Regards