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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
30 views

Calculating yaw and pitch angles between up and forward vectors and direction vector

I have a transformation matrix and a direction vector, and am trying to calculate separate yaw, pitch, and roll angles between the matrix and the direction vector. I have already calculated forward, ...
user avatar
  • 1
0 votes
1 answer
45 views

Calculate the coordinates of an offset in 3D space knowing the initial rotation and final rotation of the object

Working on a game mod in FiveM in which I am representing bullet impacts with drawn lines in the game world along their flight path. I am getting a normalized vector and then calculating the offset ...
user avatar
0 votes
2 answers
54 views

Finding the position of a point based on a relative point inside a quad

I'm trying to get the relative point position on a quad using a [0,1] Vector2, like in the picture below: The red dots are relative positions. What I'm trying to make is a function that takes the A,B,...
user avatar
-1 votes
1 answer
29 views

The vector aiming to enemy is in wrong direction

In a 2d game, I am trying to shoot at a moving enemy and the vehicle that is shooting is also moving. However, the velocity of the bullet is not in the same direction as the position of the enemy. The ...
user avatar
0 votes
2 answers
58 views

Calculate the angle of rotation between two vectors relative to the first vector

I'm trying to get the angle between two 2D vectors relative to the first vector input. Every method I've tried has given me a value between 0-180 degrees but doesn't tell me whether it was a clockwise ...
user avatar
0 votes
2 answers
45 views

Is it possible to project a vector on another vector to calculate the distance without raycasting

I have the following game scenario: Player is P and there are 2 enemies E1 and E2 I want to calculate the distance between the ennemies and the player base which is anywhere in that green line, and ...
user avatar
1 vote
1 answer
135 views

How to slide along a wall at full speed?

I was reading this answer, and while it works for that use-case, mine is slightly different (simpler?), but I can't figure out how to do it. What I'm looking for is a way for the player to retain ...
user avatar
0 votes
0 answers
29 views

Projectile Aim Prediction with Target Acceleration and Bullet Deceleration Varying with Angle

I previously asked a question about this topic here, and now I'd want to review if the offered solutions worked, and then frame a new inquiry based on the difficulties and issues that resulted. So my ...
user avatar
0 votes
1 answer
102 views

Intercept an accelerating object with a constant velocity projectile

I want to calculate the time that it takes to intercept a moving target "plane" with a projectile. For example I have two 3 dimensional vectors (2 locations in 3D space). ...
user avatar
0 votes
2 answers
36 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 ...
user avatar
0 votes
0 answers
39 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 ...
user avatar
  • 1
2 votes
1 answer
211 views

Smoothing multiple combined vector translations

I am currently working on my arm/weapon rig for an fps game written in a custom engine. I am to the point where I am implementing the movement of the arms/weapon (hereby referred to as weapon), for ...
user avatar
  • 171
0 votes
0 answers
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 ...
user avatar
0 votes
1 answer
28 views

confusion with Mathf.MoveTowardsAngle being in the Update method

I've got some code that looks like this: ...
user avatar
0 votes
1 answer
96 views

Pygame : having trouble with implementing movement with vectors

I've been struggling a lot to learn how to use vectors in programming. Now I've successfully made my own vector class but I still can't use vectors for movement. This is my class : ...
user avatar
  • 216
0 votes
1 answer
28 views

Given a set of points with color values, finding a gradated color value from a given position

I guess the verb form of gradient is "gradate" and not "gradiate"? Hi! I have a set of 2D points (actually 3D, but we can ignore the Y axis unless it's trivial) bound to color ...
user avatar
11 votes
1 answer
3k views

How can I "zero out" velocity in an arbitrary direction?

I'm currently running into an issue with my character controller using physics-based movement of rigidbodies in Unity. Here's an illustration of the issue I'm facing: Basically, after a jump, my ...
user avatar
  • 530
0 votes
1 answer
84 views

Calculating world position with parent and child transform with translation and rotation

I have two Quaternion transforms, and a viewmatrix. These are custom transforms made by Dice, and I'm working on some custom modding for an older version of Battlefield. Now, I don't have the entire ...
user avatar
  • 103
0 votes
1 answer
56 views

desired velocity and the local space z axis

This question is related to my previous post here , but, even though I did get some insight, I didn't fully get it, and hence have another dilemma. Since the dead earth series is not publicly ...
user avatar
0 votes
1 answer
51 views

using a starting and ending point, how can i find how far in-between those two points a third point is?

quick diagram to explain what i mean. i have a start and an end, the third point can be anywhere in space, but i need to calculate from 0-1 how far they are in-between these two points. The points are ...
user avatar
0 votes
1 answer
93 views

Confirming whether a user has drawn a character correctly

This is a follow-up post to this post: How can I check if a player-drawn line follows a path?. I'm having difficulty implementing the said feature and I believe it's because of a lack of math ...
user avatar
  • 103
0 votes
1 answer
59 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. ...
user avatar
0 votes
0 answers
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 ...
user avatar
  • 169
14 votes
2 answers
3k views

What are some good examples of the practical usages of cross product in game development?

I know how to calculate cross product, and know that the cross product of 2 vectors is a third vector that is perpendicular to a plane created by the first 2 vectors. However, I have not seen any good ...
user avatar
0 votes
0 answers
22 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 ...
user avatar
  • 101
0 votes
1 answer
137 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 ...
user avatar
0 votes
2 answers
241 views

In a 3D grid of cubes, how to calculate index of a cube if we only know it's coordinates and the way cubes are generated?

I have a code that generates a grid of equally sized cubes in a cubic volume of given limited size, intended to be used for 3d path finding. Let's say cubes are objects stored in an array called ...
user avatar
0 votes
0 answers
30 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 ...
user avatar
0 votes
1 answer
924 views

Get a Vector2 Based on Object Rotation in Unity

I feel like there is an obvious answer to this but I can't find it. Is there a function in unity that gives you a Vector2 (or 3) based on the rotation of an object. for example: z rotation = 0 ---> ...
user avatar
0 votes
1 answer
43 views

How to check if a point is on the plane given bottom-right point, top-left point, normal and the quaternion rotation of the plane

I know the world positions of A and B. We are also given the vector normal and the quaternion rotation of the plane How do I check if a point lies on the plane?
user avatar
  • 311
0 votes
0 answers
71 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 ...
user avatar
  • 1
0 votes
1 answer
47 views

What does a Vector3 state?

I'm really stucked. I couldn't understand what does Vector3 state. When I look Unity Vector3 documentation it says Representation of 3D vectors and points. ...
user avatar
0 votes
0 answers
34 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 ...
user avatar
  • 311
1 vote
2 answers
64 views

Given its direction, and another vector that begins at the same point, how can I find the magnitude of that vector using only vector math?

I've solved this using the law of sines, but I was wondering if there's a way to do this with just vector math. Here's a diagram that will hopefully help illustrate what I'm trying to do: Given ...
user avatar
0 votes
1 answer
36 views

Measure a distance point to point in unity3D?

I tried to measure a distance point to point on my phone screen by using following code ...
user avatar
  • 107
0 votes
1 answer
101 views

Is speed and direction generally combined into one vector, or separated into two?

Couldn't find this answered already, surprisingly. For example, for a game (in my case a 2D top-down one), there could be advantages to doing so. For example, whenever you want to change an entity's ...
user avatar
0 votes
1 answer
197 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 ...
user avatar
0 votes
1 answer
210 views

Transforming Vector3 points to Vector2

I'm trying to convert a list of Vector3 on Vector2 because I need to put them in a graph like this: The graph is easy to do having the Vector2 list, but I have a non-trivial problem obtaining the ...
user avatar
  • 3
0 votes
1 answer
68 views

Make movement speed relative to player character rotation in Unity?

I'm doing a strict topdown 2D game where the character looks at wherever the mouse is pointing (same perspective as GTA 2 or Darkwood) . I want to make movement speed for strafing and backing up ...
user avatar
0 votes
1 answer
1k views

How to calculate the Forward, Up, Right vectors using the rotation angles?

As the title says, I have the pitch and the yaw of an object, How do i use them to calculate the forward, up, right vectors (like the ones in unity), I've searched everywhere and only could find the ...
user avatar
0 votes
1 answer
44 views

How do I get my fish to face the right way?

I'm making this 2d collecting game in Unity where you collect fish. However I can't get them to face the direction they are going. I've asked on some Discords and got no answer. Thanks in advance. ...
user avatar
  • 1
0 votes
1 answer
32 views

Move vector A to vector B but stop X distance before reaching vector B and always be in front

I believe this is basic vector math, but I'm struggling with it. I have 2 objects (3D space, x, y, z), A (weapon) and B (camera). I want to move A to B's location, but then offset A from B so that it ...
user avatar
1 vote
1 answer
62 views

How to get all tiles along a straight vector path?

Let's say I have a 100x100 map of tiles where each tile is 16x16 pixels. How would I get all tiles along a path? For example, let's say I wanted to get a list of all tiles along the shortest direct ...
user avatar
0 votes
0 answers
53 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 ...
user avatar
  • 254
0 votes
1 answer
127 views

Find position in arc depending on the direction of the agent

So what I am trying to do is to find a random point on the (green") arc around the enemy: Sorry for the bad drawing but Red (no go) Green ( Points the allied can go to) I know that unity has ...
user avatar
0 votes
0 answers
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 ...
user avatar
  • 103
1 vote
0 answers
33 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 ...
user avatar
1 vote
0 answers
26 views

Moving Object Interception / Projectile Collision [duplicate]

I am using Unity to attempt to have missile A launch at incoming missile B and blow it up. However in order to do this accurately, A must be able to take into account B's current velocity, direction ...
user avatar
  • 11
0 votes
2 answers
234 views

How do i put random velocity in a Vector2?

I'm very new to C# scripting. I want to use a random velocity for my Enemies using Vector2. Here's the code that I have done at the moment: ...
user avatar
1 vote
1 answer
257 views

How do I procedurally generate rivers on a tilemap with thickness?

I have read numerous articles on the subject but can find none that can explain to me how it is that procedural river generation achieves a certain amount of thickness to the river. I have managed to ...
user avatar

1
2 3 4 5
14