# Questions tagged [transformation]

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

527 questions
Filter by
Sorted by
Tagged with
23 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, ...
77 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 <...
85 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, ...
19 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 ...
34 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 ...
740 views

### Stop an object from rotating past a certain rotation value in Unity

Learning how to program in Unity, so bare with me. I'm making a game called Flappy Bird and I'm having issues with my z-rotation boundaries. Let's say I have some gameObject (call it Bird) that goes ...
1 vote
1k views

### How can I find the offset rotation and position between two objects in 3D?

I have two objects in 3 dimensions, one of them (Child) is attached to the other one (Parent) using the offset between them (XYZ ...
381 views

### 2D engine design/architecture: transformations

Hello! I'm working on this hobby little 2D engine in JavaScript because I want to learn how all this things are implemented and architectured in general. Internet is full of resources but most things ...
44 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 ...
360 views

### how to place object relative to parent at x distance specified

My application: Place furnitures or construction objects (doors/windows) in scene. Everything is fine until I touch the construction objects. Since the application is mobile, it will be hard for a ...
1 vote
32 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: ...
1k 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 ...
41 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 ...
551 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 ...
25 views

40 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....
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 ...
1 vote
495 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 ...
8k 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: ...
55 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 ...
57 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 ...
220 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?
18 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 vote
111 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 ...
1 vote
218 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 ...
67 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 ...
250 views

### How to prevent rendered wound from sliding on moving character?

I am trying to display a rendered wound on the character, but I still can't figure out how to display it properly without sliding on character's body. I'm following this link on rendering the wounds ...
208 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 ...
1 vote
67 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, ...
1k 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 ...
1 vote
32 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 ...
115 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 ...
289 views

### 3D Ragdoll, skinned mesh + three.js + cannon.js

I'm trying to develop a ragdoll from a skinned mesh, in three.js using cannon.js as physics engine. I'm struggling with a lookAt problem for bones. Let me explain the method I used. I made a skinned ...
1 vote
45 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 ...
24 views

### Bullet spawning at world origin instead of muzzle socket on static mesh

I placed a socket called "Muzzle" on the end of my static mesh as shown here I have it so when I left click, my bullet should spawn on the muzzle socket, but for whatever reason, it spawns ...
132 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 ...
1k views

### Move camera closer (Zoom In-Out) to object that is being followed

I have implemented a main camera that follows and orbits around an object (player). Now I would like to implement a Zoom In-Out mechanic. This functionality would allows the camera to approach the ...
43 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 ...
435 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, ...
300 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 ...
35 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 ...
127 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
34 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 ...
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, ...
1 vote
552 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 ...
9k 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: <...
157 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 ...
3k views

### Change transform.localPosition to act like transform.Translate with Space.Self

I run into the problem with moving object regarding to its rotation. The thing is that I'm changing object position by assigning new transform.localPosition value. ...