# Questions tagged [vector]

A mathematical concept that can be used to express position, direction or velocity and which can simplify or outright trivialise spatial problems.

71 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
723 views

### Implementing proportional navigation in 3D

Good afternoon guys, a = N * λ' * V is the formula for the commanded acceleration required to hit the target, where N is the proportionality constant, λ' is the change in line of sight and V is ...
454 views

### Polygon 2D collision response- How do I find the correct edge a polygon hit?

Hey guys I've been seriously stressed out by this, so please go easy on me. My goal is to reflect a bullet (polygon) off of another polygon, and find the edge the another polygon, A (the bullet), hit....
93 views

### Gerstner/Sinusoidal wave directional rotation (flow) in regards to ocean currents/trade winds

I'm trying to create an ocean simulation using Gerstner waves based on the GPU Gems: Effective Water Simulation from Physical Models. So far I've completed the directional wave functionality and ...
160 views

### Godot - Offscreen Target Indicator

I have a crosshair image that will lock onto enemies that are visible in the camera and will stay on the edge of the screen when the enemy is offscreen. This works until you face more than 90º away ...
71 views

### Vector2 distance_to weird results

I'm using Vector2.distance_to to get the distance between a MeshInstance and a KinematicBody but the results aren't as expected. I'm using ...
67 views

### Weird warping with per-vertex normals

I've had this little problem for a while now, where for some reason my calculations for per-vertex normals results in a weird distortion or warping, skewing my lighting, shading, and reflection passes....
803 views

### Quaternion to direction vector - flipping

I've kinda solved this myself by adapting the Camera::setDirection code from OGRE to work for my need: Now I have the following code: ...
551 views

### Getting player cube to move left or right in relation to camera based on camera's rotation

Right now I'm trying to make the player cube move left, right, up and down in relation to the camera's rotation and position. I figured what I could do is create an empty game object, make the main ...
38 views

### 3D AxisAngle spins at 180 degrees

I am using the Axis Angle technique on objects so that they are oriented away from a planet surface like in Super Mario Galaxy. I am using two unit vectors [0,1,0] and a normal vector from the planet. ...
12 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 ...
82 views

### check if joystick magnitude is increasing

I use joystick mechanic. What I want to do is: Translating my object forward when my joystickInput.magnitude is increasing. Translating backward when my ...
26 views

### User input scheme of 2d vector field on a 2d plane for navigation

I want to create a strategy game based on distributions of "units" which can be moved around and attack each other. By distribution of units i mean that i don't have any discrete units ...
48 views

### Why does the Modelview Matrix in OpenGL not have accurately signed vector values for look vectors?

When I do a GluLookAt(0.0, 500.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0) so that I'm 500 units up on the positive Y axis looking down at the origin with the top vector of the camera pointing toward the ...
54 views

### Adding vectors and applying rotation matrix using quaternion

I have a problem and looking for help, see attached image. I have a number of points (x,y,z) which are treated as connected vectors (first point as first vector base, second point as first vector end ...
54 views

### How to vary the initial velocity of a jump based on hold time?

What I want to do is, the longer player holds the screen, the longer distance the object will jump when they release the hold. Here is my code: ...
152 views

### The Google Earth solution for panning in a 3D world

About a year ago I made a solution for panning and zooming in a 3D world (Three.js) using a formula provided by @DMGregory. Here is the post: How to panning camera on XZ axis with different angles ...
30 views

### How does displacement mapping generalize bump mapping?

This PDF discusses bump mapping, a special case of displacement mapping. A surface is represented as a function $\overrightarrow{O}\left(u,\,v\right):\:\Bbb R^2\mapsto\Bbb R^3$. In bump mapping, we ...
33 views

### Switch Vector 3 x,y,z Components Based on Rotation

I have a cube that moves by rotating on its edge. I want my code to also work for cuboids. The following code is what I'm using to rotate my cube: ...
241 views

### Using binary space partition to lay out scenes in game

Q: How can I randomly lay out these house scenes in the larger scene such that they don't overlap? I'm using the Godot Engine to create a little 2D RPG kind of game. I'm laying out a village in a ...
710 views

### SceneKit-Convert a rotation vector into rotation matrix

I'm very new and I'm studying this ARKit code from RPasecky/CubesInSpace on github where he/she convert the point of view 's rotation vector into a rotation matrix ...
2k views

### Euler angles to directional vector

I wanted to implement a directional light system in my game, and instead of passing the direction to the light, I chose to use an angle, and only later convert it to a directional vector, so it is a ...
129 views

### Movement for Box2D Bodies

I'm having trouble wrapping my head around something that should be relatively simple. I'm making a breakout clone using LibGDX and Box2D. I'm also using the Ashley ECS. For movement with bodies, I ...
119 views

### Find camera coordinate of vanishing point

Given a vector and a camera (position, angle, up vector, field of view, etc), how would I find the vanishing point of the vector in camera space?
1k views

### Aligning a gameObject to position and normal of another gameObject inside Unity

So I am instantiating a GameObject (the one with cities and trees in the image below) and trying to align it to a hex tiles on a Sphere. So after I instantiate the gameObject, I ray-cast to get it ...
783 views

### unity3d-Find angle between 3 vector3 points obtained from swipe

I was trying to find the angle between 3 vector3 points obtained from the screen swipe. The first vector3 point is the first touch position fp, the second is some intermediate touch ip and the third, ...
567 views

### Closest distance from 3D point to vector line

First let's have a look at my little drawing: I have an origin point p1 defined by x, y and z co-ordinates, and a vector v given by x, y and z magnitude. I also have an arbitrary point, p2, given ...
1k views

### How to rotate a line in 3d space?

I am trying to figure out direction vectors of the arrowheads of an arrow. Basically I'm given a normalized direction vector ...
138 views

### Rotate Points with Object in world space

I posted this in the original stack overflow then realized that a game-dev specific one exists. I am working on personal project that requires me to have 4 points surrounding an object (1 at each of ...
593 views

### Calculate initial velocity of a 3d vector-based projectile

Okay, so I got a Projectile with 2 Vectors, position and velocity. I now want to calculate the initial velocity for it in order to reach a specific point on the map. Or actually, how high has the ...
21 views

### Rear Propulsion Steering Spline, or what is this called?

What I am looking for is essentially to know what this is, or what I can google to learn how to do it... unless of course the solution is simple. You have an object at the start position facing a ...
24 views

### Why aren't my Vector3 comparing correctly?

I have a machine and a I want to check if I can place a conveyor at its connexion point. I do it by checking if the machine is at the expected Input position of the conveyor and if the conveyor is at ...
47 views

### Swept AABB vs Line Segment in 2D

I've been trying to get a swept collision detection up and running now for almost a week and I can't for the life of me get it working. There is a answer on this linked here below: Swept AABB vs Line ...
27 views

### How to check if a particular vector is pointing at X-Y plane or Y-Z plane

As you can observe from the diagram, Vector A is pointing at the Y-Z plane and Vector B is pointing at X-Y plane. Is this possible to find? Am I missing some logic or concept? EDIT: Suppose, Vector B ...
18 views

### How to follow an object with the player without stepping out the waypoint line Unity3D?

How to follow an object with the player without stepping out the waypoint line? I added four waypoints with a debug.line and tried doing some simple waypoint mechanic. I wanted the object to move from ...
52 views

### How to perform a sliding collision between a square and a circle?

Please point me to the duplicate if this has been asked before. I couldn't find it. Basically, I am creating a 2d top-down game where the player is represented by a circle, and the tiles are ...
37 views

### Where to store polygons and polygon animation?

I thought about making something with ApeOut graphics long before it came out and its release motivated me to try - I'm having tons of fun but I stumbled upon a pickle. I can imagine storing polygons ...
14 views

### Unable to get accurate y position on terrain to spawn object

all I am trying to spawn some crabbies and can't seem to get an accurate y height to spawn. I have a terrain created with GAIA Pro 2 and have tried a few things to get an accurate y value. When trying ...
22 views

### Efficient way to compare vectorial direction?

I have a bunch of random vectors representing a direction and four other vectors that we can distinguish with their pyramidal arrows at their extremity, they represent a boundary what i'd like to do ...
38 views

### How can I transform a 3D triangle to be coplanar with another congruent triangle? - How can I superimpose two congruent triangles?

I need to transform an equilateral triangle that is lying flat on the xz plane, to become coplanar with another congruent equilateral triangle. I am developing a simple low-poly space exploration game,...
305 views

### Unity - How to set IK position of Left Hand with an offset?

I have a character holding a stick with left hand. I am using IK to make the stick hit a target position. When I position left hand at target position, it works fine. But, I need to offset the hand ...
197 views

### Understanding use of dot product in speed boost pad

I am trying to understand the dot product. I have found a website that gives you intuition about this topic and one of the examples involves a speed boost pad: Imagine the red vector is your speed (x ...
392 views

### Jumping up quicker? (Paper Mario style jump)

As shown here, Paper Mario's jump takes 8 frames go reach the max jump height and 12 frames to get back to the ground. This is pretty unusual, any idea how to jump up that quick with a rigidbody? I ...
304 views

### (Unity3D) Determine If Ray Intersects Given Rectangle

I'm building a city generator for my game and I want to ensure buildings are never placed in such a way that they overlap roads. Currently I have the system build the roads, then place buildings ...
39 views

### Angle object only in the X axis

I'm trying to code a turret to angle towards a target, where I have one part of the turret only rotating on the left/right, and I want to animate another part to only angle up/down. I've got the left/...
61 views

### Move gameObject in its facing direction

I have the following four gameObjects, they have, respectively, the rotations: -90, 0, 90, 180. I want them to move as denoted in the image below This is what I got so far: ...
56 views

### Knockback to zone on non-rectangular field

I have a playing field which is divided in 4 zones (as seen on the image below) The player (blue) is on the second zone while there are 2 enemies (red) on the third zone. When the player throws an ...
71 views

### Latitude and Longitude to Vector3 Not Aligning

I am trying to align a marker sphere to certain places on a bigger Earth sphere based on the inputted latitude and longitude. The following is my code for this conversion, this code is based on the ...
31 views

### Tilt car to accomodate for larger Tire

I would like to rotate the car so that the front wheels are touching the ground without using physics. As you can see i want to rotate the car by angle a, but making sure that both tires are touching ...