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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - gpnk90

Pages: [1]
1
Graphics / Re: Movement in direction of a heading
« on: March 08, 2016, 05:19:36 pm »
Sorry, I should have explained better in my first post!

I have a ship, with a position (2D vector), angle (int), velocity (2D vector).

The objects position is updated:

Quote
vel.x = sin((PI/180)*angle) * speed * time;
vel.y = cos((PI/180)*angle)* speed * time;

pos = pos + vel;

pos.x and pos.y is then used to set the objects sfml pos. (draw.setPosition(pos.x, pos.y)



2
Graphics / Re: Movement in direction of a heading
« on: March 08, 2016, 05:06:07 pm »
The objects I'm moving have their own position and angle, the movement is dealt with and then the resulting position is then used to update the sfml position. Does this change any of the advice?

3
Graphics / Movement in direction of a heading
« on: March 08, 2016, 04:47:48 pm »
Hi,

I'm looking to move an object in a similar way to that of a ship. The user is to enter the direction the ship should sail (i.e 300 degrees) and the ship should then move in the direction of WNW on a heading of 300. Is there anywhere that explains the rotation system used by sfml? As currently a heading of 0 moves my object South.

I hope that makes sense, any help or pointers would be appreciated!

Pages: [1]
anything