This is a part of a script and i got the report (A namespace cannot directly contain members such as fields or methods Line 1 and at “private Vector2 FindVel…”
i dont see the problem… if someone knows it help outta here pleaase ![]()
private void CounterMovement(float x , float y, Vector2 mag) {
if (!grounded) return;
float threshold = 0.3f;
float multiplier = 0.3f;
print(mag.x);
if (x == 0) {
rb.AddForce(moveSpeed * transform.right * Time.deltaTime * -mag.x * multiplier);
}
if (y == 0) {
rb.AddForce(moveSpeed * transform.forward * Time.deltaTime * -mag.y * multiplier);
}
}
private Vector2 FindVelRelativeToLook() {
float lookAngle = transform.eulerAngles.y;
float moveAngle = Mathf.Atan2(y: rb.velocity.x, x: rb.velocity.z) * Mathf.Rad2Deg;
float u = Mathf.DeltaAngle(current: lookAngle, target: moveAngle);
float v = 90 - u;
float magnitue = rb.velocity.magnitue;
float yMag = magnitue * Mathf.Cos(f: u * Mathf.Deg2Rad);
float xMag = magnitue * Mathf.Cos(f: u * Mathf.Deg2Rad);
return new Vector2(xMag, yMag);
}