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.
748 questions
2
votes
2
answers
141
views
Pseudo-3D Parallax Shifting
everyone. I am working on a game that relies pretty substantially on "faking" 3D by using different parallaxing and polygonal transform techniques. In a current example, I am working on a ...
1
vote
1
answer
577
views
Given two points (A and B), how can I obtain a point a set distance along the line between them?
Let's say I have position A, that is (0,0) and Position B that is (10,5).
Now let's say I know that position C is 5 units' distance from position A in direction to Position B.
Provided that the ...
3
votes
6
answers
2k
views
How can I rotate a 16-bit signed integer vector?
I am trying to rotate a vector made of two signed 16-bit coordinates (-32768 to 32767). Using a LUT for sin/cos, I can use the standard method for rotating a vector:
...
0
votes
1
answer
92
views
Problem with 2D projection
I have a green circle:
Inside the circle, the white frame moves to wherever P, the projection of the targets 3D position into a 2D point, is.
However, outside the circle, the frame will move to the ...
0
votes
0
answers
70
views
Fast way to compare a large set of positions, rotations, velocities, etc. during runtime (possibly every frame)
The Goal
I'm working on a vr gesture recognition system. Normally these systems are dependent on "drawn" gestures, but I want something that compares position, rotation, velocity, angular ...
0
votes
0
answers
431
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, ...
1
vote
1
answer
120
views
How to calculate rotation needed to cancel out perspective shift
I have a direction vector that's pointing to (0,0,1) in local object space. How can I calculate rotation needed to rotate it on Y axis so that from camera's point of view it would look as if it's ...
1
vote
2
answers
276
views
Calculate path segments size
I have a problem more closely described on a picture below.
The idea is that I have my agent in point A and I want to get to the point B. The problem is, that agents rotation towards point B is alpha ...
0
votes
1
answer
256
views
How does vector raised to the power of another vector work?
I was watching this tutorial and at timestamp 3:03 he did this:
This blows my mind because I didn't expect that to actually work, how the heck does that work ???? For example, if I have vector (2, 3, ...
0
votes
1
answer
66
views
What is the relation between the magnitude of the cross product and dot product of two vectors?
If I have an equation:
|A×B|=A.B
What would be the angle in between A and B?
0
votes
2
answers
446
views
How do I use these Unity math functions in Godot C#?
Here's a list of math functions I'm having trouble finding a direct function match for in Godot C#:
...
0
votes
1
answer
90
views
Modifying LibGDX vector2's seems to do nothing
I have a piece of code similar to this:
Vector2 test = new Vector2().setLength(20).setAngleDeg(45);
But when I'm trying to print its contents (such as ...
1
vote
1
answer
2k
views
How to compare a vector to a rotation in Godot 4.1?
The Context
In Godot 4.1, I have a third-person character controller. It's a CharacterBody3D with a child Node3D called PlayerContent. The visual components of the character (model, etc.) are all ...
1
vote
1
answer
480
views
Godot Velocity: Invalid type in utility function "lerp", cannot convert arg 2 from Vector2 to float on line 40
I'm trying to solve a lerp problem on my velocity, searched some stuff here and there, but found nothing that solved it. Can you help me?
...
1
vote
1
answer
363
views
Raycast from isometric view without camera position?
I'm trying to cast a ray so I can implement mouse picking. My game uses 2:1 isometric with a 3D world sim that uses AABBs. Positive X points to the bottom right, positive Y points to the bottom left, ...
0
votes
0
answers
75
views
Calculate direction to push player away from wall
I'm trying to write a common 2D game and using vectors for physics.
I have 1 wall and 1 player object that can move diagonally (both are squares without rotation).
When the player object collides with ...
0
votes
1
answer
61
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 ...
0
votes
1
answer
149
views
Why is the position of my GameObject inaccurate when copying another object's position?
I've been stuck with this nightmare for a while, and it's certainly my perfectionism. What I have is a cannon that fires a shell from an object pool. The order of operations is as follows.
The ...
0
votes
1
answer
118
views
Help with understanding Vector3 math
I was making a 3rd person player controller in Unity.
Would
Vector3 inputDirection = orientation.forward * verticalInput + orientation.right * horizontalInput;
be ...
1
vote
1
answer
1k
views
How to project a Vector3 onto the xz plane?
I have this code that tries to check whether a lobbed grenade will head toward a teammate:
...
0
votes
1
answer
353
views
Walk on any surface, how to make a defined space around character not pass through any collider
I'm working on an 3D insect/spider controller that will walk on any time of surface. Currently my character scan the environment around him by shooting a very big number of spherecasts and based on ...
1
vote
1
answer
1k
views
Find look at rotation with offset
I've been trying to make a function similar to "Find look at rotation" but with an offset. Imagine I have a pivot and an object attached to that pivot with some location and rotation offset. ...
0
votes
1
answer
3k
views
Using atan2 vs dot product to get an angle in 2D games
I have some confusion that I need to be cleared up about the atan2 function.
I am making a game in Godot where a 2D ship rotates to face some object in space by ...
0
votes
1
answer
92
views
How to find combination of vectors to equal target velocity?
I have a space craft in a 3d world that moves along the X Z plane. Given that I have 4 thrusters with one at each cardinal direction, and the ship can rotate itself about the y axis. Is it possible to ...
-1
votes
1
answer
143
views
Move object on World's XYZ axes
I'm trying to move my Character on the world's XYZ Axes, but how do I get them?
I'm trying to do this because my Player is sort of a Sphere and is rolling around, so its xyz directions are rotating.
I ...