what am i doing wrong? error CS1503: Argument 1: cannot convert from 'float' to 'int'

void FixedUpdate()
{
if (Path == null)
return;

if (currentWaypoint >= Path.vectorPath.Count)
{
reachedEndOfPath = true;
return;
}
else
{
reachedEndOfPath = false;
}

Vector2 direction = ((Vector2)Path.vectorPath[currentWaypoint] - rb.position).rormalized;
Vector2 force = direction * speed * Time.deltaTime;

rb.AddForce(force);

float distance = Vector2.Distance(rb.position, Path.vectorPath[currentWaypoint]);

if (distance < nextWaypointDistance)
{
currentWaypoint++;
}

}

Hey there:

  • Please use code tags in future posts
  • Please post the full script, including the variable declarations. Especially for errors concerning type mismatches!
  • When posting an error, please post the full error message, including the line the error occurs at. If posting an edited script (for example shortened by removing unrelated methods), tells us what line the line in the error message represents in the posted example
  • Copy paste the actual code from your IDE, dont retype it. As it is, the code you posted at the very least should not compile because “rormalized” is not a valid name.

Help us help you :slight_smile:

3 Likes

sadi1 this is your 812343rd time posting the code without tags. not to mention your posts are always bare, silently serving some messy code on a white canvas, always having same or similar issues, without ever solving them, like there is no progress with you. can you at least acknowledge that you have received this humble request loud and clear?

here is the topic if you need a step by step guide how to do it. please.

2 Likes

hi, im sorry i didnt see the replies till now cuz i managed to fix it, thatnk you so much for the advice. also im a slow learner but im trying hard cuz i started learning coding about 1 week ago

1 Like

thank you for the advice, im sorry about not posting the full code i forgot to copy it and didnt notice also the error doesnt fit so idk what to do. thank you so much for pointing the “rormalized” idk how i didnt notice

Post the whole script using code tags, and post the whole error message.

The error message contains the line the error is on, and the code tags makes it easier to find that line and work out what is going wrong.

EDIT: Nevermind, I see you did that in a new thread