Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

# Questions tagged [transformation]

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

468 questions
Filter by
Sorted by
Tagged with
15 views

### How to calculate camera view matrix from world transform, specifically the orientation?

In my engine, camera is just any other object in the scene. It has a transform -- position, rotation (quaternion), and scale (ignored for camera view matrix). I want to convert this to the camera's ...
• 189
32 views

### Correct camera transformation for first person camera

I am making a camera in openGl and I am having troubles with first person camera. So I had a few versions of camera transformation and all of them had their own problems. So at first, I was doing ...
24 views

### Find out (general) orientation of cube faces with rotated and translated camera

I have the following problem. I have a camera that is initially looking at a cube. The cube is with center at (0, 0, 0). The camera that is initially on (0, 0, 60). The camera can rotate and translate ...
26 views

### Changing Model's rotation to keep its left side toward the pivot as it goes in a circle

I wrote a little script for my scene that allows my ship to circle an island, and it seems to work alright. Now I am trying to get the ship model to stay broadside to a pivot point in the center of ...
• 137
1 vote
49 views

### What is the correct way to combine transforms together?

I have a type called transform in my game engine: ...
33 views

### Moving Object "in or out" along the z axis using Sin(time) or Cos(time)

I am new to game development, and I have successfully moved an object in the x and y directions using Mathf.Sin(x) and Mathf.Cos(x). But I'm unable to move same object in the z-direction (in or out). ...
• 1
35 views

### Unity Follow Object Movement in Local Space?

I have two objects in my scene each at different positions and rotations in the scene. In this example, object A (the leader) moves according to controls. I need object B (follower) to follow the ...
1 vote
52 views

### How do I make a mask that dictates which layers are visible in Unity?

I'm trying to create an effect where the player progresses from one level to the next by a portal appearing as a rip in the fabric of time, and the portal grows until it'd half the screen, then ...
• 75
44 views

### Convert a dot product scalar for a triangle's slope, into a translation ratio?

Struggling with accurate terminology; I've got a 3D app with triangulated terrain, where it looks like a checkerboard from the top view, where every cell is two tris, and every cell is equal size (1 ...
• 49
34 views

### transform.localPosition does not wok in Unity

When im breaking fence GameObject there should pop up scores, so it works fine. But position of pop up scores is too low, im trying to raise it by ...
35 views

### Trying to understand proper naming of transformations and coordinate systems

So far in my code I only dealt with transform matrices that I fed to OpenGL (the 4x4 float matrices), and had a class that was used to do transformations on the CPU side and generate the OpenGL ...
• 163
27 views

### Easy code to make object raise when collecting item? (new coder)

Trying to make the statue (queen) in the background raise from the ground when an item is collected (which currently just gets destroyed to show that) and having issues with timelines and assigning ...
1 vote
71 views

...
12 views

### How to convert local location to global location given orientation?

I'm working with Unreal Engine and I've come across a scenario where I have a location vector point in local coordinates and I need to transform it to global ...
40 views

### Each time a new platform spawns, rotate it 90 degrees from the previous

All I want is when the platform changes its position on the x or the z axis, then rotate the whole platform by 90 degrees. When I try to do this with the following code, I don't see any change - the ...
69 views

### confusion on desired velocity

In one of the videos of the dead earth game dev series , the author mentions of calculating a local desired velocity of a NavMeshAgent. My point of confusion was, ...
33 views

### How to make a sprite face the mouse while remaining upright, without negative scale?

In the game I'm creating I have a sprite that needs to constantly be facing the mouse, but the sprite also always needs to be facing "up". Because of the Polygon Collider 2D and Shadow ...
83 views

### Calculating child world translation, rotation and scale

I'd like to know if it's possible to calculate a child's world translation, rotation and scale individually. I'm used to seeing devs resorting to matrix multiplication and then decomposition, like so: ...
20 views

### Adjusting custom 2D transform gizmos to work with rotated shapes

I am trying to coding 2D transform gizmos with Rotate and Scale options. There are only two button. One is for rotate the object and another one is for scale the object in local space: GIF If rotation ...
55 views

### camera snapping weirdly when aligning to view

The apply word above comes from 'blender 3D'. Basically, once you rotate an object , it's x, y, z value changes. What apply does is keep the transformation, but, change the x, y, z value back to 0. Is ...
• 53
102 views

### Why do my bullets always go the wrong way when my player turns around?

So I tried to make a shooting mechanism for my game. My player can shoot in the direction pointed by the mouse. My player can also turn around, facing the other way as he walks. The firing mechanism ...
• 88
46 views

### Obj file vertex coordinates to new coordinate space

I am trying to convert the vertex positions in my obj file to a new coordinate system. I understand I need to multiply each vertex with the transformation matrix, however I am trying to figure out the ...
• 101
64 views

### Calculating view matrix from rotation, elevation and location

I have the rotation(A), elevation(B) and location(C) of a camera in a left handed 3d space. +...
• 101
14 views

### how to make an axis from one gameobject the same as the axis from another gameobject

I am making a third person script in unity and I want it so that when you aren't moving you can pan around the player and when you are moving the player faces in the opposite direction to the camera ...
• 155
260 views

### Difference between World matrix and Model matrix?

My current understanding of the Model matrix is that it is per object and stores the transformation, rotation, and scale of the object in local object space. What I'm not sure about, is that whether ...
• 149
1 vote
135 views

### Pygame 2D : rotation around center not working properly

here is the code I use to rotate an image around its center: ...
• 216
1 vote
108 views

### What are the pros and cons to using Transform{position, scale, rotation} over Matrix (3x4)?

I'm using Transform in a certain case where I want extracting/changing/preserving the components {position, scale, rotation} to be straightforward - I guess that is a benefit. But when it comes to ...
• 111
179 views

### How to use Transform.lossyScale in a local reference frame?

According to the Unity docs for Transform.lossyScale, this attribute is "The global scale of the object". From what I can tell, this isn't actually an estimate of the scaling aligned with ...
• 131
1 vote
36 views

### Visualizing collision rectangles in world space

I am calculating collision for my fps-camera by checking if the x/z-position of the camera is inside a plane. And the detection works fine. The plane is represented as two-component vectors min and ...
• 320
262 views

### What happens if first we scale a rotation matrix and then multiply it with an object?

This question has been bothering me lately. I know the correct order to scale, rotate and transform a matrix but the question I have is very different. What if we first scale our rotation matrix by ...
140 views

### Why is transform matrix order is reversed in my Scene graph implementation?

I have researched this a lot and so far all the examples, tutorials etc always use the following order: Scale * Rotate * Translate but for some reason this order must always be backwards in my Scene ...
• 189
49 views

### OpenGL translation based on “scaled” pixels? (Not physical pixels)

My (2D!) game runs in a “scaling mode” so to speak, and I’ve yet to find anyone asking this question anywhere. Basically, I want to achieve a sort of “scaling algorithm” whether graphics are ...
57 views

### How to construct a matrix with the following mapping

How would I create a matrix that maps coordinates like so: Near plane x: [-3,3] -> [-1,1] y: [-6,2] -> [-1,1] z: 2 -> -1 Far plane ...
156 views

### How does Unity know where the character is facing?

I just learned Quaternion.LookRotation and it's used for rotating an object. I used it to face my character in the direction where it's moving, but I couldn't ...
215 views

### Get world object transform relative to another object (potential parent)

I'm attempting to parent a bullethole decal to a dynamic object. I've figured out how to set the correct position for the bullethole object so that it shows at the correct position of the dynamic ...
• 171
50 views

### Rotating a cube with arrow keys

I have a list of rotations (on a cube in 3d space with the y-Axis pointing upwards, x-Axis pointing righthand and z-Axis pointing towards you) for example +90 deg around x-Axis followed by +90 deg ...
• 1
168 views

### How mesh transformation works under the hood

We can look at the most popular engines like Unity and Unreal engine (maybe Godot and other). As far as I understand (at least I would do this), we store the original mesh, and then for every change (...
• 103
102 views

### Normalize a rotation around the Z-axis (issue with GLM)

I'm trying to undo some transformations coming from an external tool*. I'm getting different results depending on subtle differences in the input and wondering how to convert to a rotation about the Z-...
• 1,300
22 views

### Scaling transforms by time, Eigen Decomposition of Affine Transforms

I posted this question in mathematics, but that sight gets flooded with homework problems... 8 views total, most of them me. Plus, I think this question is more geared to game development anyway. I am ...
42 views

### track 2D offset after rotation

red is my origin point, blue is my offset, both are 2D vectors, how can calculate blue after rotation? this is the code I've been trying(just throwing things against a wall to see what sticks) ...
55 views

### Mesh does not translate accordingly to WheelCollider

So I am trying to implement a car controller script in Unity were the WheelTransform position and rotation is set with every update as the same as the ...
140 views

### My Earthbound-like Movement Script works in Unity Gameview, but runs differently in Gamebuild

First programming question I've ever made in my short journey. I'm trying to create a script which moves members of your party in a line behind you (think Chronotrigger or Earthbound). Here's a clip ...
212 views

### Invert parent transform (doesn't work for combination of rotation and scale)

My problem I'm working with Qt3D and my problem is almost exactly like this one: https://stackoverflow.com/q/60995155/3405291 Suggested solution A solution is suggested here: https://stackoverflow.com/...
• 141
144 views

### Instantiate prefab on specified position of GameObject on scene

I have a room that I want to connect to a staircase. Both the room and the stairs have the following parameters: I need to "magnet" the "Room Exit" position of the room (start ...
79 views

### How to get correct axis for scaling from transformed space?

I have scaled and non-scaled representation of model so that I don't destroy verticis information if model will be scaled to plane, for example. Now I trying implement scaling on model elements (face, ...
• 13
5k 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 ...
• 395
130 views

### Where is the Mclip matrix & how do I set it?

According to this article, the Mclip matrix will be used, but I didn't find any function in Directx11 to set this matrix. How do I set it?
72 views

### Turning the Turret towards Player Object

I  am trying to turn the enemy turret towards player object using the Armory 3D game engine with Blender. The script is written using Haxe. I am using the following code with both the player object ...
744 views

### Why do I get a jitter/stutter when moving and following a target?

I am using the script below to move a transform to quickly follow a target (the player), and come to a stop close to the player. When I move the player around, the transform is following the player, ...
81 views

### Unity Transform Origin during Animation

I have a sliding animation on this penguin model which moves the penguin from a standing position to a belly position. During this animation, I've noticed that the object transform origin stays locked ...
• 101