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
0answers
23 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 ...
0
votes
1answer
12 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 ---> ...
1
vote
1answer
25 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?
0
votes
0answers
38 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 ...
0
votes
1answer
44 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. ...
0
votes
0answers
24 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 ...
1
vote
2answers
40 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 ...
0
votes
1answer
24 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 ...
0
votes
0answers
12 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 ...
0
votes
1answer
59 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 ...
0
votes
0answers
38 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 ...
0
votes
1answer
49 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 ...
0
votes
1answer
28 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 ...
0
votes
1answer
102 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 ...
0
votes
1answer
39 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. ...
0
votes
1answer
27 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 ...
1
vote
1answer
33 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 ...
0
votes
0answers
34 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 ...
0
votes
1answer
16 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 ...
0
votes
0answers
10 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 ...
0
votes
0answers
21 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 ...
1
vote
0answers
25 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 ...
1
vote
0answers
18 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 ...
0
votes
2answers
110 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: ...
1
vote
1answer
138 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 ...
2
votes
1answer
87 views

Trying to understand 3D transforms by making an aircraft control script. How would you implement 3D transforms correctly in this example?

I'm struggling to understand 3D transforms in Godot. (I know, I know...) I'm trying my best to implement an aircraft control script, and I've gotten myself into gimbal lock hell. My controls work ...
0
votes
2answers
150 views

When are oblique triangles used in game development?

I'm working on a project that explains how trigonometry is used in video games, and I need to mention oblique triangles. However, as far as I know, only right triangle diagrams are used in video games ...
0
votes
1answer
43 views

How to convert relative position of child to parent into an absolute position?

I am modifying a game that stores object positions with a 3d vector { x, y, z } and rotation as a 3d vector with degree angles ...
0
votes
1answer
72 views

How to rotate velocity Vector3 to always point the same direction so that it can be applied to 2d blendtree?

Given two variables, a Vector3 representing body velocity and a Quaternion representing body's local rotation, how could I normalize the velocity vector so that it's always oriented towards the ...
0
votes
2answers
109 views

Rotating towards a target in top-down 2D game

I use the following code to rotate a transform towards another. And it's working fine. However, I want to lerp it over time period. ...
0
votes
0answers
37 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,...
0
votes
1answer
202 views

Jump script using AddForce not working

I am making a simple jump script by adding a separate script to the character. I got the character from the Asset Store and I have left it untouched. I have searched the solution and similar problems ...
0
votes
1answer
55 views

How to calculate the dot product between the input direction and a character with root motion?

I need to calculate the dot product between my character movement direction and the input being pressed by the player. When the character movement was being controlled only by code, I was using ...
0
votes
2answers
28 views

Math: determining a proper procedural vector for sine-movement

My Problem Suppose you have an object moving along the x-axis, wobbling up and down. Movement code might look like this: x += 1; y = Sin(x); Move((x,y) * speed); ...
2
votes
0answers
90 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 ...
0
votes
1answer
29 views

Move Object θ Degrees Over T Time

Note, this happens on click and not in the update cycle I have a game object that i rotate at a given angle, around a point without a time component like this(works as intended): ...
0
votes
1answer
36 views

How to re-calculate orientation vectors when one of them is being changed?

I want to implement a Unity-like API for my transforms, with the ability to set forward, right, up vectors directly and change object's rotation quaternion accordingly. I got stuck at the math behind ...
0
votes
0answers
245 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 ...
0
votes
1answer
167 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 ...
2
votes
1answer
129 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 ...
0
votes
1answer
385 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 ...
0
votes
1answer
195 views

ECS: Movement system

I'm a game developer enthusiast. I've decided to implement a game, however I'm pretty confused about all the movement mechanics (kinematics). Here goes a couple questions: Velocity x acceleration x ...
2
votes
2answers
237 views

LibGDX Efficient way to reduce a vector's value gradually until it reaches 0,0

I can manage to achieve this but the code seems to be much longer than it should be. Velocity is given an initial value, either positive or negative and then is ...
0
votes
2answers
65 views

How to calculate a movement Vector3 to kill unnecessary momentum and start moving in the right direction?

Imagine a rocket is accelerating in a straight line toward PointA, picking up momentum every frame, then suddenly decides it wants to go toward PointB instead. It can't just turn straight toward ...
0
votes
1answer
35 views

GameObject LookAt not aligning properly

I have a celestial sphere with a plane in the centre and spheres (stars) aligned around the centre with a fixed radius. In order to show the stars visible from a certain latitude and longitude from ...
2
votes
1answer
63 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 ...
0
votes
1answer
224 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 ...
0
votes
1answer
25 views

Issue picking the closest vector in a unique circumstance

I have a list of targets that can be picked depending on the magnitude from the vector created using: ...
0
votes
1answer
32 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/...
0
votes
1answer
80 views

What is the signifigance of the Dot Product in World to Local Transformations?

Looking for help understanding why this World to Local Space function works. I'm working my way through Buckland's Programming Game AI By Example The following function is used in the book to convert ...

1
2 3 4 5
14