Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Moving towards direction of rotation.  (Read 597 times)

0 Members and 1 Guest are viewing this topic.


  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Moving towards direction of rotation.
« on: November 01, 2020, 05:59:08 pm »
There have been questions posted on this in the past but some are contradictory and I'm having trouble abstracting. I've successfully got my player moving in the direction of the player however It follows a sin/cos path when moving. I'm relatively new and was wondering if i could be pointed in the right direction.
I imagine it has something to do with my DeltaTime or velocity as their values are changing.

void Movement()
        direction.x = sin(DegToRad(playerSprite.getRotation()));
        direction.y = -cos(DegToRad(playerSprite.getRotation()));

        playerSprite.move(direction.x * velocity.x * Delta_Time() * movementSpeed, direction.y * velocity.y * Delta_Time() * movementSpeed);


  • SFML Team
  • Hero Member
  • *****
  • Posts: 10191
    • View Profile
    • development blog
    • Email
Re: Moving towards direction of rotation.
« Reply #1 on: November 28, 2020, 11:56:42 am »
Can you describe in more detail what you're trying to do?
Also if you've already found some releated threads, make sure to link them. :)
Official FAQ: https://www.sfml-dev.org/faq.php
Nightly Builds: https://www.nightlybuilds.ch/
Dev Blog: https://dev.my-gate.net/
Thor: http://www.bromeon.ch/libraries/thor/