Questions tagged [transformation]
Transformation in game development is usually refers to linear algebra operations on points, vectors and matrices.
527
questions
95
votes
9
answers
57k
views
Why do we move the world instead of the camera?
I heard that in an OpenGL game what we do to let the player move is not to move the camera but to move the whole world around.
For example here is an extract of this tutorial: OpenGL View matrix
...
64
votes
2
answers
30k
views
I'm rotating an object on two axes, so why does it keep twisting around the third axis?
I see questions come up quite often that have this underlying issue, but they're all caught up in the particulars of a given feature or tool. Here's an attempt to create a canonical answer we can ...
29
votes
1
answer
6k
views
What is the standard practice for animating motion -- move character or not move character?
I've downloaded a bunch of (free) 3d warriors with animations. I've noticed for about 25% of them, the 'run' animation physically moves the character forward in the z direction. For the other 75%, the ...
26
votes
2
answers
6k
views
Using Quaternions: What can I do with them? (without the maths)
I am a Game Developer and did not study Mathematics. So I only want to use Quaternions as a tool. And to be able to work with 3D rotation, it's necessary to use Quaternions (Or Matrixes, but let's ...
15
votes
3
answers
51k
views
How to extract euler angles from transformation matrix?
I have a simple realisation of entity/component game engine.
Transform component have methods to set local position, local rotation, global position and global rotation.
If transform is being set new ...
14
votes
2
answers
4k
views
Why do we need a fourth coordinate to divide by z?
I read the response here:
What does the graphics card do with the fourth element of a vector as the final position?
"The fourth component is a trick to keep track of perspective
projection. When ...
13
votes
2
answers
12k
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, ...
12
votes
1
answer
15k
views
How does Mikktspace work for calculating the tangent space during normal mapping?
Increasingly the 3D industry is adopting the standard of Mikktspace for calculating tangent space for normal mapping and other effects which rely on accurate and consistent calculation of tangent ...
11
votes
1
answer
969
views
Special relativity shader in GLSL
I'm trying to implement a GLSL shader which helps understanding special relativity Lorentz Transformation.
Let's take two axis-aligned inertial observer O and <...
10
votes
2
answers
6k
views
How can you extract orientation from a transformation matrix?
I have a 4x4 transformation matrix M, and I want to find out the shape of a sphere when transformed by M. (Sphere is at the origin and has radius 1.)
I know I can find the center by just multiplying ...
9
votes
4
answers
4k
views
Geometric Transformations on the CPU vs GPU
I've noticed that many 3d programs normally do vector/matrix calculations as well as geometric transformations on the CPU. Has anyone found an advantage in moving these calculations into vertex ...
8
votes
2
answers
5k
views
Why translation uses multiplication and not addition? [closed]
To translate an object from (x, y, z) to (a + x, b + y, c + z) it's done using:
OK, that's cool, but why would we multiply in ...
8
votes
2
answers
2k
views
How do I create a draggable object which snaps to obstacles in the way?
I bring yet-another-drag-with-mouse question (I am using Unity with C#), but with a less common particular detail: the existence of obstacles in the middle of the way trough which dragging occurs (3D ...
6
votes
3
answers
4k
views
Most efficient way to get the world position of the 8 vertices of a Box Collider
What I am looking for is the most efficient way to get the world position of the 8 vertices of the Box Collider of a freely rotated Game Object. I cannot use collider.bounds since object is rotated, ...
6
votes
3
answers
26k
views
How do I make a background fill the whole screen in Libgdx?
I'm using this code to set a 800x420 image to be full screen:
...
6
votes
3
answers
22k
views
Rotate object to always face camera
I'm trying to make a TextMesh appear when ever an enemy prefab is hit.
I currently have this functionality working. However, the text doesn't face the direction the players camera is looking.
At the ...
6
votes
3
answers
951
views
Transforming a primitive tetrahedron into a primitive icosahedron?
I've created a tetrahedron by creating a BoundingBox and building the faces of the tetrahedron within the bounding box as follows (see image as well):
...
6
votes
2
answers
5k
views
Transform world space using Kinect FloorClipPlane to move origin to floor while keeping orientation
The Kinect SDK provides a property SkeletonFrame.FloorClipPlane that describes the orientation of the floor plane relative to the camera. MSDN contains slightly more information in the Coordinate ...
6
votes
1
answer
1k
views
How can I attach a model to the bone of another model?
I am trying to attach one animated model to one of the bones of another animated model in an XNA game.
I've found a few questions/forum posts/articles online which explain how to attach a weapon ...
6
votes
1
answer
454
views
How can I convert OBJ data into CSS3D transformations?
I want to convert the data in a 3D .obj file (vertices, normals, faces) to CSS3D (width, height, rotateX,Y,Z and/or similar transforms). I found a bunch of ...
5
votes
1
answer
6k
views
How does a 4x4 matrix represent an object in space and matrix lore?
I have been following some tutorials on how Matrix maths works, with adding, dividing, scaling, etc, but I am struggling to understand how the 4x4 matrix represents an object's position in space.
...
5
votes
1
answer
3k
views
LibGDX viewport touch coordinates transformation
I've been trying to get LibGDX's viewport and camera unproject() to work and so far none of the tutorials/answers I've found have worked for me.
I have a game window of 840x480 units with FitViewport....
5
votes
1
answer
819
views
Do matrix manipulations for 3D graphics ever produce singular matrices?
A singular matrix is a matrix that cannot be inverted. The vecmath library, for example, throws a SingularMatrixException if you try to invert a singular matrix.
I think I understand what singular ...
5
votes
1
answer
1k
views
How do I deal with floating-point error given a far-away camera?
Whenever a camera is "far" away (its location is some "large" vector), trouble arises when rendering objects close to it: It is the classic precision loss from subtracting 2 floating point numbers.
I ...
5
votes
1
answer
1k
views
Does converting quaternion to matrix cause a lot of overhead?
This is related to rendering creating a model, view, projection matrix for opengl. While matrix are fairly standard there's a lot of talk about using quaternions for rotations but why would u go from ...
5
votes
2
answers
1k
views
Precision loss when transforming from cartesian to isometric
My goal is to display a tile map in isometric projection. This tile map has 25 tiles across and 25 tiles down. Each tile is 32x32. See below for how I'm accomplishing this.
World Space
World Space ...
5
votes
1
answer
460
views
Are there multiple valid definitions for what translate, rotate and scale do?
Are there multiple valid definitions for what translate, rotate and scale do to the 4x4 matrix?
I bring up this question, because I have a simple webgl program that draws a square and does a few ...
5
votes
1
answer
890
views
importing animations in Blender, weird rotations/locations
This is for the Blender 2.6 API.
There are two problems:
1. When I import a single animation frame from my animation file to Blender, all bones look fine.
But when I import multiple (all of the ...
4
votes
3
answers
3k
views
In Unity, how to get reference of descendant?
I'm trying to get descendant game object, not a child. Let's assume that I have a GameObject and it's hierachy looks like this:
...
4
votes
1
answer
483
views
Does vector transformation order matter?
Theoretical question - imagine a car object. There are two (or more) 'forces' acting on this car, these forces will affect where the car will steer. But the forces are calculated using car's location ...
4
votes
2
answers
20k
views
How can I stop transform.position from being modified when adding a child object?
I suspect there is a well-known and easy to explain reason for the behavior I'm seeing, but I am having difficulty explaining it (and likely not able to Google for the answer).
When adding a child <...
4
votes
1
answer
4k
views
Is it more efficient to transform vertices on the CPU or the GPU?
Working on optimizing the rendering core of my game engine and I have a couple of questions.
Is it more efficient to transform vertices to world space on the CPU before you send then stream to the ...
4
votes
1
answer
2k
views
Should a transform class store a matrix or seperate position/rotation/scale values?
I'm creating a transform class to make storing the transform of individual objects in a scene easier, but I'm unsure on how to do it.
I could create one like this:
...
4
votes
1
answer
15k
views
How to mirror/reflect/flip a 4D transformation matrix
I am importing my animation keyframe joint data from Blender to my game engine. The joint data is a set of 4D matrices. Things are looking good except a remaining issue where the animation is facing ...
4
votes
1
answer
2k
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.
...
4
votes
1
answer
340
views
How to scale major and minor radius of a quarter torus
I am dealing with quarter tori as in the image below. My issue is that I need to be able to scale its major radius and minor radius separately using a scale matrix. However, when I use a regular ...
4
votes
1
answer
375
views
What methods can be used to rotate a tiled structure?
I'm trying to rotate some structures that are locked on a grid-like structure. This means I'm looking for lossless ways to rotate the tiles. Maintaining proper distances are not important, I'm aware ...
4
votes
1
answer
9k
views
Object scaling when parenting by script
How do I make it so an object doesn't scale with another object that I parented it with by script? If anyone knows how to get around this I would really appreciate it.
This is the part of the script ...
4
votes
1
answer
725
views
How to transform mesh components?
I am attempting to transform the components of a mesh directly using a 4x4 matrix. This is working for the vertex positions, but it is not working for the normals (and probably not the tangents either)...
4
votes
3
answers
5k
views
Translating an object in the rotation direction
I am creating a graphical scene with OpenGL and SDL, and I'm running into a problem in regards to translating an object in its rotation direction.
Each of the graphical objects in the scene has a <...
4
votes
1
answer
693
views
What is the proper way to convert meters to pixels when using Box2D?
I'm working on a platformer and I've chosen to use Box2D for physics but I'm having trouble converting meters to pixels. I have a static object and a dynamic object. The dynamic object falls onto the ...
4
votes
2
answers
14k
views
Unity / Rotate a point around an arbitrary axis and anchor
I'm trying to find out the point which is already rotated. To solve this I did a Rotation, save the position, set the previous position and return my position, like this:
...
4
votes
3
answers
2k
views
How do I create a view matrix directly from a quaternion and a position vector?
Given a quaternionic camera such that:
...
4
votes
0
answers
913
views
Shadow mapping - Can't get the right texture coordinates
I'm trying to implement shadow maps for Spotlight's, but alas I can't get them to work. I have verified that my fragment shader is getting the shadow map texture. I can sample from it in the ...
4
votes
1
answer
1k
views
How to translate swipe gestures into rotations?
I am making a snake game. I want to rotate my snake in the direction specified by swiping on the screen, the directions are limited to orthogonals (90 degree increments). It's an android game.
Can ...
3
votes
4
answers
3k
views
How and when do the model to world, world to view, et cetera multiplications happen?
I learn matrix transformations for game design and I struggle with some basic concepts. I see the actual multiplication taking place before rendering in this sequence:
MODEL into WORLD: multiply each ...
3
votes
1
answer
39k
views
How can I translate a game object towards a position?
I am instantiating my game objects (spheres) through scripts. I want my spheres to move from one location to another. but I don't know how to do this. Update is ...
3
votes
2
answers
4k
views
How can I reflect a point with respect to the plane?
How can I reflect a point with respect to a plane?
Example:
I have three points (0,0,2), (4,0,0) and (0,8,0). And I have a point (x,y,z). From these, I want derive a composite transformation matrix. ...
3
votes
4
answers
5k
views
(unity) move the world or the character
I'm making a game like this:
https://www.youtube.com/watch?v=hO7573lphqI
wherein a 3D ship is flying around on a 2D plane. From the player's perspective, the ship will stay stationary in the center ...
3
votes
2
answers
7k
views
How to compute the forward, up and right vectors from a single quaternion?
Given a quaternion
float x, y, z, w;
How does one the forward, up and right vector from a single quaternion?
...