# Questions tagged [transformation]

Transformation in game development is usually refers to linear algebra operations on points, vectors and matrices.

410 questions
Filter by
Sorted by
Tagged with
1k views

### Find the 4 Corners of a Bounding Box of a Rotated, Offsetted Square

How does one find the coordinates of the 4 corners of a bounding box of a square of width w and height h that is rotated ...
974 views

### Transform inertia tensor using quaternion

I have inertia tensor T in body coordinates and quaternion q for the body. I know I can transform T to world coordinate by converting quaternion to rotation matrix R and then use the relation (R * T * ...
419 views

### Strange Light Angles in Unity

I'm quite sure that I'm missing something very simple here, but I'm a complete Unity noob and I absolutely can't figure out what I'm seeing. I'm trying to light a sphere from both sides, ...
138 views

### Instantiated object can't be parented

I'm writing a script (in C#) which, on mouse down, will spawn a gun and parent it to a game object. But for some reason the gun is instantiated just fine, but it doesn't parent. I have an empty game ...
723 views

### In the Unity Editor, how to push a parent's transform down to its children?

I've inherited a Unity scene with quite a deep object hierarchy. Some GameObjects in the hierarchy don't have any geometry of their own, and just exist to group ...
2k views

### How to move one object to another object's position

So I'm want to move one game object (my player) to the position of another game object, on keyDown. I'm just not sure how to reference the position of the object which is where I want my player to ...
5k views

### LookRotation() make X axis face the target instead of Z

I use LookRotation() in order for an object to look at another, but since I'm using 2D I would like to make the axis looking/facing the target to be X instead of Z. I have the code below currently: <...
58 views

### GameObject transform with respect to local camera?

I'd like to recycle objects as they pass behind the camera frustum -- i.e, the plane of the local Z axis, orthogonal to the camera vector: ...
133 views

### In UnityScripting C#, What's the distinction between global coordinates and world space?

In Unity game engine and C# scripting; Is there any distinction between global space and world space? Are this two the same thing and identical or there is a distinction? I'm not confusing between ...
3k views

### Calculate vector3 global point projecting it in local space using Unity and C#?

How to project a vector 3 locally ? Unity has a special function for this? For example, if a has a GameObject that contains 2 children Vector A (transform) "My A Arrow" and Vector C (transform) "My C ...
2k 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 ...
208 views

### Creating a skybox in Allegro 5

I'm trying to render a "skybox" using Allegro 5, that 3D objects can move around "in front" of. I'm having trouble figuring out how to set up the projection transform and where to put the vertices for ...
561 views

### Convert a transformation matrix from world-space to camera-space using Eigen

I have a transformation matrix, in world space. I need to convert it to local(camera) space. I have done the reverse of this (Local - to - world) using: ...
1k views

### Detect transform from detection of QR code?

I want to calculate the transform I need to render a 3D object in my world. How I see my idea: You open a camera You point it at a QR code The app detects the QR code and returns the 4 corners and ...
19k 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 ...
1k views

### Unity transform.rotation not giving real value

i confused , when the object is at 0 rotation ( not rotated yet ) , it giving real value ( 0 ) , but when the object is rotated 180 degree , transform.rotation is giving false value ( 1 ) , this is ...
49 views

### Help with Transform Path

I have a 2D square. It has an initial position translation T0. It rotates about the Z axis, about an arbitrary point, say 45 degrees, then moves (translates) along the +X axis some distance. I'm ...
83 views

### Cube Translation Looks All Wrong

I'm making a very simple cube in OpenTK and it seemed to be going fine until I tried to move it around. Moving it along the X Axis seems to elongate the cube, not the result I hoped for. My Vertex ...
255 views

### How do I convert positions between local coordinate systems?

Say I have worlds and levels. Each world contains multiple levels. Levels have their own coordinate system, centered around their pivot point (assume its centre, for example). These level coordinates ...
487 views

### Transform manipulator for Unity/Oculus Touch game like in Quill, Medium etc

I'm trying to create a script to manipulate the transform of a gameobject using the Oculus Touch just as in for instance Quill or Medium, with rotation, translation and scaling. Can somebody help me ...
291 views

### How to use 3D transformation matrices with GLM old version that has simd functions

I need matrix 3D transformation, model transformation i.e scale-rotate-translate and then that model into world space so model-projection-view matrices. I need it with GLM specified simd vectors and ...
202 views

### Scale sprite between two points

I need to start a sprite at a scale .6 (scale1) at a y position 40 (yPos1). Knowing the end y position 560 (...
5k 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 ...
9k 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: ...
74 views

### Rotated canvas sprite not drawing properly

First, sorry for my english. Said that: Recently I began to study JavaScript and like a way to consolidate what I learned I decided to make a simple video game with canvas and javascript: kind of ...
47 views

### Transform point while keeping other points offset

I have the following situation: I've got a box with its center of mass transform matrix that I'm obtaining from physics simulation, i.e. it keeps changing with time. I've also got two points (actually ...
275 views

### Quaternion precision problems

Each entity and camera have a Transformation object that holds position info as vec3, rotation info as quat and scale info as vec3. When I need a matrix (that being ...
174 views

### Axis of affine transformation matrix

Let's say I have a right handed column major 4x4 transformation matrix. Can I safely assume (even though there exist non uniform scale) that first column is X axis vector, second column is Y axis ...
190 views

### Finding the Distance between 2 Objects

I have 2 objects One Having a Transformation Matrix T1 and other Having Transformation Matrix ...
189 views

### Understanding the ModelView Matrix

I want to analyze the each component of my 4*4 ModelView Matrix. I came to know that the starting 3*3 of ModelView Matrix ...
143 views

### Rotating an Object Around an Axis

I have a circular shape object, which I want to rotate like a fan along it's own axis. I can change the rotation in any direction i.e. dx, dy, dz using my transformation matrix. The following it's ...
19 views

### Script of trajectory without itween

I use itween for trajectories of car. I do not want to use him anymore because I find him very heavy.( more 100 cars in my scène) I found scripts but all one a variable speed to turn around points. It ...
829 views

### how to properly rotate in directX11

I am trying to Rotate a textured quad in directX however I think i am missing something. I am pretty sure it is because i am applying transformations to the WorldMatrix instead of the ObjectWorld, ...
705 views

### Scaling a rotated rectangle in a given direction

I'm facing an issue when trying to scale a rotated rectangle in a given direction. In my context, the width and height of the rectangle are based on the texture size multiplied by a scale factor (...
165 views

### Why won't character stay at the x-axis rotation I set In the inspector?

Here is a snippet of my Update function, which contains everything regarding my rotations for the character: ...
4k views

### How to orbit an object around another object in an oval path in Unity?

I would like to create kind of planetary orbit structure for my game. I was used ...
8k 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 ...
517 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. ...
45 views

### What is a good practice for deciding when to use transforms instead of applying force?

I was making several games. I don't understand when I should use addTorque instead of rotate. AddForce instead of position The latest game was a pinball game. I wasn't sure the best way to active ...
116 views

### Tank bullet shooting

Ok, I'm having a lot of trouble understanding using Matrices for Movement in a 2D game. I currently have a Tank object that has a Matrix3 globalTransform managing the direction Scale and Rotation. ...
191 views

### Implementing my own UI sprite class in Unity using shaders: where and how to position the sprites

For learning purposes, I am trying to implement my own UI classes in Unity "from scratch", in the GPU using shaders. I mean, I am trying to use simple 2D sprites either positioned via shaders or ...
75 views

### How to get an game object to instantiate lower than where It's created?

When I press the collider where my allies spawn I want for them to spawn a little bit lower when I instantiate. I have tried to use Vector 3 and GetComponent, but It gives this error: 'Assets/...
317 views

### Bullet: Apply any Transformation to RigidBody?

I'm using Bullet for CollisionDetection. I load a scene from a Collada-File using Assimp. Let's say I want to give every object in the scene a RigidBody with a box as CollisionShape. Right now I first ...
4k views

### Extract a rotation matrix given a camera direction (vector) and a up vector for the camera?

I am having some issues constructing a rotation matrix from a camera direction vector. The Up vector is computed from the camera direction as such: ...
202 views

### How to compute a transformation matrix that describes each position and rotation on a sphere?

I am having an issue constructing my transformation matrices, for this sphere problem. I know the 3d coordinate of the center, and the radius of, the sphere. Since I know the radius and center of ...
443 views

### SceneGraph in Entity Component System, Transformations

I'm recently learning entity component systems, and started implementing it into my test engine, however I'm having an issue integrating this with scene-graph, which I'm trying for the first time. ...
3k views

### Fastest way to neutralize scale in the transform matrix?

Let's assume we have 4x4 3D transformation matrix, that is the result of scale, rotation, and translation transforms. How to set its scale to (1,1,1) in the fastest way? Assume also that the matrix is ...
931 views

### Rotating A model in 3D so it matches its direction of movement

So I have a model of a spear and when it gets thrown I want to set the orientation of the spear to its direction. ( I also want to use this for other things like bullets pointing in the direction ...