# Questions tagged [transformation]

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

528 questions
Filter by
Sorted by
Tagged with
18 views

### How to match Sprite3D's collision poly to its billboard transform?

Assume there is a Sprite3D with a Y- billboard flag on. This sprite3D has a matching CollisionPolygon3D Collision polygon3D is set up to "look" at the camera with a look_at() function, ...
• 17
1 vote
41 views

### Cannot transform vectors from viewport to world

I started working on a small raytracer project, and i decided to reuse my already existing openGL renderer to do this, i'm using GLM to manage transforms/positions. However, i stumbled upon a very ...
1 vote
56 views

### How to calculate a direction vector from a 3x3 rotation matrix?

I have a dataset containing 2D images of telco towers and metadata. Each 2D image has 3x3 rotation matrix which provides orientation info about the drone when it captured the image. Now I have a 3D ...
70 views

### Suspension vector direction of a raycast vehicle

I'm working on a raycast-based vehicle in a 3D world using a physics engine. It's basically a chassis object that contains a transform (translation, rotation, scale), a dynamic rigid body (with mass, ...
• 736
108 views

### How can I calculate vertex positions for a rectangle outline using a unit square, vertex normals, model matrix and outline thickness?

I'm trying to draw a hollow rectangle (i.e. the border of a rectangle without the middle) using a unit square plus normals. The actual positions are being calculated in my vertex shader. For example, ...
• 123
199 views

### invert:condition "det==0" is true error with no obvious cause

For my project I am turning my CharacterBody3D 90 degrees on the x-axis towards a wall. To achieve this I set basis.Z to the <...
• 23
20 views

### while rotating around Y in Transform, it rotates around Z in Viewport Is it a bug in Unreal Engine 5.3?

I struggle to understand how the transfomartion is working in Unreal. I've faced one interesting situation and cannot realize what happed. Could somebody explain please why my rig is rotating around Z ...
• 131
36 views

### Usage of 'World rotation quaternion'?

While debugging the code that decomposes the world matrix, I found that the decomposed world rotation value is different from the world rotation value stored in Transform. Simply, World Rotation is ...
45 views

### Using an InputField to enter a distance and then move an object to a location based on the input: object returns to old position

I have attached a script (1) to the InputField for ease and it displays HA changing when I alter it during run time in the ...
• 3
1 vote
41 views

### 3D transform hierarchy rotation applied in wrong order

I'm following in the footsteps of this blog in implementing a transform hierarchy to my game engine scenes. I have a fairly similar implementation for a 3D transform: ...
• 111
43 views

### How to obtain the Position on the screen (Vector2) of the Position of an object in the world (Vector3)?

I have been searching around for a solution to this but still haven't been able to use it or find it, the thing is i need the Screen Position of an object that is being seen, for this i have three ...
• 121
27 views

45 views

### What transformations are performed under model space?

I am struggling to understand the relationship between model transformation, model space, and world space. I understand that model transformation transforms an object from model space into world space....
1 vote
506 views

### In the Unity editor, why are the coordinates of a newly created root object not set to 0,0,0 when the object is at the origin?

My initial coordinates of a newly created object without a parent are not 0,0,0 They’re supposed to be at the origin. Instead they are some random number. And how can I set them to zero without moving ...
• 131
61 views

### Efficently Computing the Inverse Affine Transform

Given a single affine transformation in 3D (i.e., TRS transforms) that is represented by a translation vector (t), quaternion (r) and scaling vector (s). Is there some way of efficiently computing the ...
• 105
81 views

### Efficiently Computing a Composed Affine Transform

Given two affine transformations in 3D (i.e., TRS transforms) called T0 and T1, each represented by a translation vector (t), quaternion (r) and scaling vector (s). Now, say that I want to compute the ...
• 105
305 views

### How do I create a localtoworldmatrix and worldtolocalmatrix in Godot?

From what I can tell Godot uses Projection for 4x4 matrixes, but I see no way to generate a localtoworldmatrix from a given transform in Godot, how do I do this?
• 145
21 views

### How to stretch a cylinder when dragging with a Ray Interactor?

I'm making a VR game in Unity. I want to select a cylinder with ray interactor and drag it, and as I drag, it should stretch. This is the code I have currently for 2D: ...
• 1
1 vote
132 views

### How to set world rotation directly in Stride?

I just started looking into Stride as a replacement for Unity, and I'm trying to rewrite some scripts. My question is: How do you set the world rotation of a transform component? In other words, what ...
• 13
1 vote
232 views

### I want to convert world coordinates into camera coordinates

In world space, I have an axis (eg. [-1, 0, 0]) and a point (eg.[2,5,1]). I also have a 4x4 viewmatrix. Now I want to transform that axis and point in camera frame. I am getting really confused. Does ...
• 113
84 views

### How to keep an object that rotates around another at the same height when the radius changes?

In my game, I have one object that rotates around another using transform.RotateAround, and I need to change the radius of its orbit. The behavior now is that the ...
• 1,757
261 views

### Why doesn't RectTransform.GetWorldCorners() employ any camera?

Typically, conversion methods from world to screen coordinates and vice versa use a camera to perform these calculations, so I'm wondering how does GetWorldCorners ...
• 383
1 vote
74 views

### Move object continuously along y with optional movement along x

I am looking for a sensible way to continuously move an object downwards with constant speed while moving left or right by some amount x when the user presses the left or right arrow keys. Basically, ...
• 116
2k views

### How do I keep a node centered while animating scale in Godot?

When scale is modulated, the item scales from the top-left corner. I tried changing anchors preset to "center" but it still scaled from the top-left corner. How do I make it scale from ...
• 235
1 vote
35 views

### How do I rotate OBJ submeshes relative to themselves (or arbitrary point, as opposed to relative to the whole model)?

I'm creating my own flight simulator game from scratch, using Swift and Metal, for learning purposes, and I'm wondering how I can move certain parts of my aircraft model. My model is a free OBJ file ...
• 11
143 views

### When to use InverseTransformDirection in Unity

I want to know when to use InverseTransformDirection. Unity documentation says : "Transforms a direction from world space to local space". Honestly, it is not clear for me. I came across ...
• 169
1 vote
47 views

### Clamp rotation of a follow camera when its target is falling

I'm using this camera script to follow a cube. The cube has rigid body with gravity enabled. There is a plane on which the cube moves. If it goes off the plane, the cube starts falling. However when ...
156 views

### LocalPosition always (0, 0, 0) on UI component after assigning it in script

I have a card prefab setup to render a card like this: I'm in the process of creating a hand prefab to contain a set of cards and manage the animation to slide in each of the cards. Each hand has 5 ...
• 219
45 views

### Orient a player mid-air to their predicted landing orientation in Unity?

Ever played Skate 3? When dropping into a ramp, or if you're midair, your player's up direction aligns to the normal of the surface you're about to land on, while respecting the player's forward ...
524 views

### How to glue objects together so they move as one?

I'm making a puzzle game and can't find ANY solution on how to glue parts so I can move them together as a unit. :( I tried to making them depend like parent and a child, but when I touch the child, ...
673 views

### How to check if one object's local bounding box contains another

I am currently trying to check whether the first object contains a second. I first tried to use the bounding box, but it is defined in world space, so it is not working with my rotated cubes. Then I ...
• 2,054
439 views

### How to set up view and model matrices for 3D rendering?

For various reasons I am building a very simple graphics engine. I have a pretty good 2D thing using plain SDL2 and C that essentially boils down to a single "putpixel" function. I can ...
• 235
36 views

### How do I spawn the tiles on the global z axis instead of local z?

I'm trying to spawn infinite tiles in a 3D runner game, but the tiles are spawning at the wrong position and on the wrong axis. Technically, the code is working as it should, it is spawning and ...
130 views

### How do I make an object move to a certain location when the player looks at it?

I want to have an eyeball that when the player looks at, it disappears by moving to the side. Like in a horror game. I know how to make the object move to a set location but I don't know how I would ...
1 vote
35 views

### Set hologram position to the corresponding position of an object the mouse is hovering over, but offset is doubled for some "mounts"

I am making a factory game and for it I need to set the position of a hologram of a machine so that the end of the hologram's conveyor snaps to the end of the machine next to its conveyor when ...
176 views

### Keeping background image fixed along Y axis of cinemachine camera

I have a background that I'd like to remain in the same position relative to the camera along the y-axis, but scroll in parallax along the x-axis. The x-axis parallax part I was able to implement just ...
• 99
208 views

### Respawn Player to Respawn point when colliding with a Hazard

I have grid movement set up for the player within a set space. The player moves one unit at a time and can move several units when holding down a direction key. I would like the player to respawn back ...
119 views

### Find coordinates in one space from another

I'm trying to determine what coordinates are in one space when given a point in another space. For example, I've got a Matrix4x4 that I can use to convert a point in unity's world space to a skewed ...
200 views

### Problems with rotating Child Objects

I'm writing a Transform script for a Monogame project and I'm trying for a few days now to fix the Rotate method of this script, but without success. Currently, the Parent transform only rotates ...
765 views

### I have imported a FBX model. It has predefined Transform values in Imported Object setting in the Inspector. How can I change those transform values?

what my problem is: I imported FBX models, when I click those objects from Project tab, I see the values of Transform are different and can't be changed (The Transform values under Imported Object ...
• 21
1 vote
782 views

### Y in transform.position has different value in inspector than in code

I've got very simple code: ...
• 111
886 views

### Detecting whether sprite is outside the camera's view

I want to detect when the game object is not visible anymore. I search for the size of the SpriteRenderer, and convert it to screen space. Then, I check if the ...
33 views

### Need help replicating this unity transformation in raylib [duplicate]

i was hoping i could get some advice on a transformation im trying to perform on some billboards. i have a billboard in 3d space thats being rotated a long the view matrix's up + right axis, against a ...
1 vote
173 views

### Shaking UI World Space element when keeping it centered between 2 objects

So I have a ship in the game, and I can click on a Sail to make a World Space UI panel appear. The panel will follow the selected sail and also always Billboard towards the camera. The problem I have ...
237 views

### Finding the center of rotation in 3d knowing the start/end transformations

I need your help to solve a trigonometry problem, I'm unable to find any documentation about on the web... For convenience, I will use "transform" to indicate a position+orientation. Let's ...
1 vote
706 views

### GridMap centers meshes of different heights in cell

I am trying to use the superb GridMap in Godot 4 beta 5. I have, so far, only 2 different types of meshes in my MeshLibrary. 1x1x1 cube 1x1 plane My intention is ...
1 vote
668 views

### How do I move an object along its local axis?

I am new to computer graphics and am trying to make a simple little game where I can move a cube around with the keyboard. I have it so you can rotate the cube with the arrow keys, and I wanted to ...
• 13
46 views

### Little problem with offsetting transformed vertex in a vertex shader

I’m working on some home-made menu stuff under DX11. I’m creating the rect menus at start all located at position 0,0. Each menu contains some lines of options. Everything is created as transformed ...
• 139