The circular movement of an object around a specific axis.
19
votes
2answers
1k views
Calculating the rotational force of a 2D sprite
I am wondering if someone has an elegant way of calculating the following scenario.
I have an object of (n) number of squares, random shapes, but we will pretend they are all rectangles.
We are ...
11
votes
4answers
2k views
How to rotate blocks in tetris
I have a gameboard grid which is 20 rows high and 10 columns wide with the origin (0,0) being in the top left hand corner.
I have a tetrimino in play, which is composed of four blocks.
I have the x,y ...
9
votes
2answers
2k views
How can I rotate about an arbitrary point in 3D (instead of the origin)?
I have some models that I want to rotate using quaternions in the normal manner, except instead of rotation about the origin, I want it to be offset slightly. I know that you don't say, in 3d space, ...
9
votes
3answers
535 views
Can I use quaternions to control an helicopter?
I'm trying to make a simplified helicopter (for the moment, it's a cube) simulation in 3D and I'm having some problems with rotation. An helicopter can rotate along the three axes :
rotate on itself ...
8
votes
2answers
297 views
Render 3d object to 2d surface (embedded system)
i am working on an embedded system of a sort, and in some free time i would like to test its drawing capabilities.
System in question is ARM Cortex M3 microcontroller attached to EasyMX Stellaris ...
8
votes
2answers
616 views
Arbitrary Rotation about a Sphere
I'm coding a mechanic which allows a user to move around the surface of a sphere. The position on the sphere is currently stored as theta and phi, where theta is the angle between the z-axis and the ...
8
votes
4answers
230 views
Keeping rotation between two objects
In my XNA game I have two objects that collide. When the first object collides with the other it is able to latch on to it and move it about the world. I am having a problem with the math here (Math ...
7
votes
1answer
909 views
Xbox thumbstick used to rotate sprite, basic formula makes it “stick” or feel “sticky” at 90 degree intervals! How do you get smooth rotation?
I am using a very basic formula to calculate what angle my sprite (spaceship for example) should be facing based on the Xbox controller thumbstick i.e. you use the thumbstick to rotate the ship.
In ...
7
votes
2answers
417 views
Rotate a vector
I want my first-person camera to smoothly change its viewing direction from direction d1 to direction d2. The latter direction is indicated by a target position t2.
So far I have implemented a ...
7
votes
3answers
429 views
Routes on a sphere surface - Find geodesic?
I'm working with some friends on a browser based game where people can move on a 2D map. It's been almost 7 years and still people play this game so we are thinking of a way to give them something ...
7
votes
2answers
867 views
Calculating a quaternion so a bone points in a specified direction
In an attempt to solve this question, I decided to figure out the absolute (world space) directions of each joint in the source pose (as normalized unit vectors), and then rotate the joints of the ...
6
votes
3answers
384 views
Tetris : Effective rotation
I rotate each piece by rotation formula. More detail, because rotation angle is 90 so :
xNew = y;
yNew = -x;
But my method has met two problems :
1) Out of box : each type of pieces is fit in ...
6
votes
3answers
672 views
Why is my model's scale changing after rotating it?
I have just started a simple flight simulator and have implemented Roll and pitch. In the beginning, testing went very well; however, after about 15-20 seconds of constantly moving the thumbsticks in ...
6
votes
1answer
219 views
How can I get a 2D texture to rotate like a compass in XNA?
I'm working on a small maze puzzle game and I'm trying to add a compass to make it somewhat easier for the player to find their way around the maze. The problem is: I'm using XNA's draw method to ...
6
votes
2answers
517 views
AABB of rotated sprite?
Say I have a sprite. Its AABB is easy to find since I know the width and height. Say I rotate it 45 degrees, I don't think the AABB would be big enough to cover it, so I need a new AABB. How can I ...
6
votes
1answer
461 views
How To Approach 360 Degree Snake
I've recently gotten into XNA and must say I love it. As sort of a hello world game I decided to create the classic game "Snake". The 90 degree version was very simple and easy to implement. But as I ...
6
votes
2answers
946 views
Simple thruster like behaviour when rotating sprite
I'm prototyping some 2D game concepts with XNA and have added some basic keyboard inputs to control a triangle sprite.
When I press key up the sprite accelerates in it's current facing direction, ...
6
votes
2answers
742 views
How to implement friction in a physics engine based on “Advanced Character Physics”
I have implemented a physics engine based on the concepts in the classic text Advanced Character Physics by Thomas Jakobsen. Friction is only discussed very briefly in the article and Jakobsen himself ...
6
votes
2answers
1k views
How do I rotate a structure of hexagonal tiles on a hexagonal grid?
My 2D isometric game uses a hexagonal grid map. In reference to the image below, how do I rotate the light blue hexagon structures by 60 degrees around the pink hexagons?
EDIT:
Main hex is (0,0). ...
6
votes
2answers
695 views
What is eigenvalue decomposition and why would it be useful in games?
In various math libraries developed for game engines, I see 2x2 and 3x3 square matrices having this function (along with some helper functions). I tried to find information regarding it but did not ...
6
votes
1answer
2k views
Rotation of bitmap using a frame by frame animation
I have one large bitmap that has four frames drawn on it and I only draw one at a time by looping through the bitmap by increments to animate walking. I can get the bitmap to rotate correctly when it ...
5
votes
3answers
524 views
How can I make a character move forward in a certain direction?
I have an entity class which is updated every game tick. Let's just assume said entity moves forward constantly. What i want to know is, how can i make it so that i can give an angle to a function and ...
5
votes
1answer
327 views
Calculate gears rotation for a realtime simulation
Hi I'm trying to do a game with real time simulations of gears. There is a big Gear with inside a smaller gear.
I managed to draw gears with different diameters but equal size teeth, but if i try to ...
5
votes
3answers
640 views
Rotate a particle system
Languages / Libraries in use: C++, OpenGL, GLUT
Okay, here's the deal.
I've got a particle system which shoots out alpha blended textures to produce a flame. The system only keeps track of very ...
5
votes
1answer
109 views
Rotating plane to be parallel to given normal via change of basis
I have two planes and their respective normals. I would like to rotate the second plane, planeB, so that it is parallel to the first, planeA.
To do this, I am using a change of basis to rotate each ...
4
votes
4answers
3k views
GLM: Euler Angles to Quaternion
I hope you know GL Mathematics (GLM) because I've got a problem, I can not break:
I have a set of Eular Angles and I need to perform smooth interpolation between them. The best way is converting them ...
4
votes
1answer
1k views
How do I rotate a sprite so that it is 'pointing' in the direction it is moving
I have a sprite, e.g a missile, heading in a certain direction (using a velocity vector).
How do I figure out its how much to rotate it so that it gets drawn 'pointing' in the direction it is ...
4
votes
2answers
2k views
Move sprite in the direction it is facing?
I'm using Java/Slick 2D. I'm trying to use the mouse to rotate the sprite and the arrow keys to move the sprite. I can get the sprite to rotate no problem, but I cannot get it to move in the direction ...
4
votes
3answers
173 views
How do I make an arrow line up with a bow when rotating them?
I am trying to create a bow and arrow animation in which the player can drag downwards to increase the bow strength (see the image) and release it to hit a target. I can't get the arrow to align ...
4
votes
1answer
174 views
Orbiting multiple objects evenly around a changing radius
I have multiple objects (circles) and I want to place them in a circle, with even distance between each one, and have them orbit the center of the screen.
If I remove one object, I want the orbit ...
4
votes
4answers
2k views
Need a good quality bitmap rotation algorithm for Android
I am creating a kaleidoscopic effect on an android tablet. I am using the code below to rotate a slice of an image, but as you can see in the image when rotating a bitmap 60 degrees it distorts it ...
4
votes
1answer
851 views
Turning a sprite such that it rotates in the direction that's most efficient
I have a sprite that moves from waypoint to waypoint. It turns to face its velocity vector, but not instantly (there's a rotation speed).
The problem I'm having is, from one direction to another, the ...
4
votes
2answers
540 views
I need help with 2D collision response (of stacking rotating polygons, with friction and gravity, for a game)
Hi I am looking for suggestions on how to write a collision response for game programming purpose (so not a scientific simulation). I am dealing with 2D polygons that are rotating, and I want them to ...
4
votes
2answers
577 views
XNA 2D Rotated Rectangle Collision Response
I am using Rotated Rectangles which collide using the Separating Axis Theorem and they work perfectly fine for collision detection using Intersects and Contains.
However, I am starting to use faster ...
4
votes
1answer
435 views
Arcball Problems with UDK
I'm trying to re-create an arcball example from a Nehe, where an object can be rotated in a more realistic way while floating in the air (in my game the object is attached to the player at a distance ...
3
votes
6answers
1k views
How to get quality sprite sheet generation with rotations
I'm working on a game that uses sprite sheets with rotation for animations. While the effect is pretty good, the quality of the rotations is somewhat lacking. I exported a flash animation to png ...
3
votes
4answers
670 views
Is it better to track rotation with a vector or a float?
In XNA, you can see that to draw a rotated sprite with SpriteBatch, you'll need a float describing the angle in radians.
I'm used to making games in OpenGL. I just want a rapid prototyping ...
3
votes
3answers
471 views
How to calculate origin and position of a weapon which should be “in hands”?
I'm currently stuck with my game, which is from the top perspective. I'm currently using these sprites for player: (using the second at the top):
And here's what I use for my gun
My problem is ...
3
votes
3answers
868 views
How to keep my Quaternion-using FPS camera from tilting and messing up?
I am using an FPS-like camera, and it uses quaternions. But, whenever I try looking up and then sideways, it tilts, and sometimes it can turn upside down. How can I fix this?
3
votes
1answer
289 views
Clock hand, how much should I rotate the hand by every frame?
I've got a virtual clock.
The clock consists of the actual clock sprite, and a hand to go over it.
I'm able to set how long the clock duration is.
Say I set it to: 5 seconds.
While the clock time is ...
3
votes
3answers
6k views
How can I rotate a camera about it's target point?
I'm drawing a scene where the camera freely moves about the universe. The camera class keeps track of the view (or look at) point, the position of the camera, and the up vector. These vectors/points ...
3
votes
1answer
185 views
How rotate a 3D cube at its center XNA?
I try to rotate a 3D cube on itself from its center, not the edge.
Here is my code used.
public rotatemyCube()
{
...
Matrix newTransform = Matrix.CreateScale(scale) * ...
3
votes
2answers
272 views
How is the gimbal locked problem solved using accumulative matrix transformations
I am reading the online "Learning Modern 3D Graphics Programming" book by Jason L. McKesson
As of now, I am up to the gimbal lock problem and how to solve it using quaternions.
However right here, ...
3
votes
2answers
574 views
How can I implement smooth rotation from one direction to another?
I'm having a problem with animating rotations with 1Matrix.CreateRotationY() with my basic 3D game. Based on where you click the mouse, I want the 3D object to rotate to that direction and then move.
...
3
votes
1answer
3k views
How to calculate a 3x3 rotation matrix from 2 direction vectors?
I've got 2 direction vectors, for the X axis and the Y axis of the object. How do I calculate the rotation matrix of the object using these?
3
votes
2answers
315 views
3D rotation matrices deform object while rotating
I'm writing a small 3D renderer (using an orthographic projection right now).
I've run into some trouble with my 3D rotation matrices. They seem to squeeze my 3D object (a box primitive) at certain ...
3
votes
1answer
323 views
Smoothing rotation
I've spent the last three days trying to work out how to rotate a sprite smoothly depending on the velocity.x value of the sprite. I'm using this:
float Proportion = 9.5;
float maxDiff = 200;
float ...
3
votes
2answers
574 views
Quaternion understanding
I have some understanding problem concerning quaternions.
In order to have my world object rotate in the correct way, I need to invert their quaternion rotation while refreshing the object world ...
3
votes
1answer
223 views
Rotating 3d plane to XY plane
I have a triangle in 3d space and would like to create a grid over the triangle, such as in the image below.
The purpose of this is to store information about each block of the grid. In order to ...
3
votes
2answers
485 views
How to rotate camera centered around the camera's position?
Currently I am using gluLook at like so:
gluLookAt(position.x, position.y, position.z,
viewPoint.x, viewPoint.y, viewPoint.z,
upVector.x, upVector.y, upVector.z);
with the ...
