I am new to Unity and i am trying to convert the CharacterControl script from the book “Unity 3 Game Development Hotshot”.
I have most of it but am having trouble with two things
The error i get is Expression denotes a type', where a variable’, value' or method group’ was expected
jS -
public function IsGrounded () : boolean
{
return (c_collisionFlags & CollisionFlags.CollidedBelow);
}
C#
public bool IsGrounded()
{
return (c_collisionFlags & CollisionFlags.CollidedBelow);
}
the error here is Cannot implicitly convert type UnityEngine.CollisionFlags' to bool’
The second one is more tricky. The & in c# is a bitwise AND. I’m not sure if it’s the same in java (I suspect it is). Clearly ‘CollisionFlags.CollidedBelow’ isn’t a boolian object and I can’t see what type it is so it’s hard to help here.