Tag Info

Hot answers tagged

5

Start by adding a variable for the angle that the car is moving at. float angle = Math.Pi / 2; Then add a variable for the current speed. float speed = 0.0; Now create three constants: public static final float acceleration = 0.1; public static final float maxSpeed = 5.0; public static final float rotationRate = Math.Pi / 50; For starters, get your ...


1

It depends on the coordinate system you're working in. In a right-handed coordinate system (eg. x right, y up, z points toward the viewer), the right-hand rule applies, as mklingen describes in the existing answer. In a left-handed coordinate system (eg. x right, y up, z points away from the viewer), the left-hand rule applies - you point your left thumb ...


1

Quaternions are not axis/rotation vectors. That's just not how they work. They do encode an axis/rotation, but not in the way you describe. Check out the equation from wikipedia: Given an axis [a_x, a_y, a_z] and angle theta, q = [a_x * sin(theta / 2), a_y * sin(theta / 2), a_z * sin(theta / 2), cos(theta / 2)] That said, if you do have an axis/rotation ...


1

If you look at a circle with the angles marked you will see that 270 degrees corresponds with (0,-1) i.e. straight down. By convention degrees are marked as acceding in a counter-clockwise direction. They do however form a loop and as such 270 degrees (purple arrow) can also be expressed as -90 degrees (orange arrow) i.e. a quarter turn in the opposite ...


1

First use Zehelvion answer to make the car turn correctly, then: Use the timestamp, you measure how much time it took for your last iteration and use that to modulate the speed at which you are changing things. void RunGame(float deltatime) { if (key.KeyCode == Keys.Up) { Player1.speed += accelaration * deltatime Player1.speed = ...



Only top voted, non community-wiki answers of a minimum length are eligible