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
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 ...
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 ---> ...
5
votes
1answer
508 views

Problems with Raycasting Requirements

Im working on a script which kinda works like an Enemy AI. Its kinda like a detection system with requirements that are required to be met. This is a recent question i asked using my code Raycast ...
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
1answer
188 views

How can I detect whether a point is moving in a circle?

I want to detect if my GameObject (Vector3 Point) being dragged by the player's finger is moving in a circular fashion. I thought I could save the last 5 points ...
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
168 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 ...
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
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
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 ...
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 ...
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
433 views

Change sprite angle on sloping ground

I have a problem here with GameMaker built-in physics environment.My player is designed to be on a skateboard. I want my player to rotate its sprite, according to the kind of fixture(up or down slopes)...
3
votes
6answers
7k views

How to implement object velocity as a vector

I'm working on a Breakout game, and want to change the ball's movement code from how I currently do it, to something based on vectors (as I feel learning and implementing movement based on vectors ...
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
105 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 ...
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
225 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
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
28 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 ...
4
votes
2answers
1k views

Controlling roll rotation when travelling along bezier curves

I am currently working on a curve implementation for use in Unity which includes an editor: The aim is to get an object to follow the path represented by the curve at a constant velocity. Currently ...
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/...
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 ...
4
votes
1answer
179 views

How can I draw an animated vector field on a map?

I want to render an animated vector field map similar to this wind speed visualization. How can I do this?
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 ...
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
55 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 ...
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 ...
1
vote
1answer
112 views

How to mirror a vector through some other vector?

I have a player's direction (playerDirection). I want to fire two bullets, one rotated by -30f, and one by 30f, so it looks like this: Blue line is the ...
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 ...
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
votes
1answer
297 views

Can not seem to adjust the speed of my Car

I'm programming in C++, rendering in OpenGL and using GLM for matrix/vector manipulation and ...
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 ...
52
votes
4answers
53k views

What are normal, tangent and binormal vectors and how are they used?

I would like to find out the following information: What are they? Example usage in game development (the area they are used in) About the following vector types: ...
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 ...
-1
votes
2answers
44 views

Unity C# combining two areas each represented by a vector [closed]

have two areas, which are both given in there bounds.size. Now the z-axis doesnt matter for me, since im working in 2D. I want to add these vectors so i have a vector, which represents the jointed ...
5
votes
5answers
10k views

How to detect if object is moving in clockwise- or counterclockwise direction?

I've read this one, but I need more info: rotating an object from sourceAngle to destAngle, both 0-359, clockwise or counter clockwise? I have a ball. The user is able to drag the ball in any ...
2
votes
2answers
3k views

Relative cam movement and momentum on arbitrary surface

I have been working on a game for quite long, think sonic classic physics in 3D or Tony Hawk PSX, with Unity3D. However I'm stuck at the most fundamental aspect of movement. The requirement is that I ...
0
votes
1answer
44 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 ...
1
vote
1answer
140 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 ...
10
votes
3answers
16k views

Get points on a line between two points

I'm making a simple space game in JavaScript, but now I've hit a wall regarding vectors. The game view is top-down on a 2d grid. When the user clicks on the grid, the space ship will fly to that ...
10
votes
3answers
10k views

How do I interpret the dot product of non-normalized vectors?

I know that if you take the dot-product of two normalized vectors, you get the cosine of the angle between them. But if I take the dot-product of two non-normalized vectors (or one normalized, one ...
2
votes
2answers
2k views

Intelligently move aircraft using curves

I am trying to code a script to move an aircraft entity from point A to point B and at some point in the middle of moving have the aircraft forward vector face Point C (to fire a missile at an enemy ...
3
votes
2answers
153 views

How to rotate vector A around another vector B?

Lets say I know what is directly above a turret. I also know where the turrets gun is currently pointing. I would like to know where will the turret's gun will point if I rotate it. I suppose I could ...

1
2 3 4 5
14