Search Unity

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

Discussion in 'Scripting' started by sadi1, Oct 19, 2020.

  1. sadi1

    sadi1

    Joined:
    Sep 16, 2020
    Posts:
    15
    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++;
    }

    }
     
  2. Yoreki

    Yoreki

    Joined:
    Apr 10, 2019
    Posts:
    2,605
    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 :)
     
    orionsyndrome, Joe-Censored and sadi1 like this.
  3. orionsyndrome

    orionsyndrome

    Joined:
    May 4, 2014
    Posts:
    3,116
    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.
     
    Joe-Censored and sadi1 like this.
  4. sadi1

    sadi1

    Joined:
    Sep 16, 2020
    Posts:
    15
    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
     
    orionsyndrome likes this.
  5. sadi1

    sadi1

    Joined:
    Sep 16, 2020
    Posts:
    15
    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
     
  6. bobisgod234

    bobisgod234

    Joined:
    Nov 15, 2016
    Posts:
    1,042
    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