A mathematical concept that can be used to express position, direction or velocity and which can simplify or outright trivialise spatial problems.
0
votes
2answers
27 views
Velocity Relative To A Vector
So I have a velocity vector b in world space and I have a "pointing" vector a in world space. I need to know how to make the velocity vector to be relative to the "pointing" vector. Better explanation ...
-1
votes
1answer
33 views
How do I get a vector from an angle?
I want a ship to move forward in the direction it's facing when you press the up key, but I don't know how to get a normalized vector from the angle the ship is facing. Can someone show me what code ...
0
votes
1answer
30 views
Getting vector relative to other vector in rotating object
So I have a rotating object a. It is rotating at non-constant speed around it's local x axis. It is parented to object b. When the object a rotates, it's local x axis stays facing the same direction ...
0
votes
1answer
64 views
How do you build a rotation matrix from a normalized vector?
I'm trying to find the correct way to build a rotation matrix from a unit vector. I have two arbitrary points in space (p1 and p2), and I'm trying to create the vertices for a rectangle to span ...
0
votes
2answers
35 views
Get vector3 position of Cursor on a fixed 2D plane within a 3D scene
How is it possible to get a cursors X and Y Location relative to the scene planes rather than using co-ordinates based upon pixels of screen height and width?
I have the start of a very basic game, ...
0
votes
0answers
29 views
What Is Vector Math? [duplicate]
Okay so I was wondering, what exactly is "Vector Math"? I was wondering if I needed to know physics for game development, and most people said you just need to understand the basics, but they said ...
1
vote
0answers
51 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 ...
0
votes
2answers
64 views
Moving a ship forward from rotation
I am making a simple space simulator, where the player can control a ship using 2 controls, one for pitch and one for bank. The ship is properly rotated but I cannot figure out how to make the ship ...
1
vote
2answers
82 views
Vector math to calculate the rotation and drift of a tectonic plate?
I've been following the excellent Experilous procedural planet generation post, trying to recreate it in Java using libGDX. My planet is simpler, as it lacks any distortion of the mesh. It's just ...
1
vote
0answers
19 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 ...
1
vote
1answer
33 views
find Vector2 libgdx
I need to get coorinates of red point. Coordinates are just for example, it would be better to see the common formula. Found code like this, but it gains wrong result.()
Vector2 o = new ...
6
votes
2answers
138 views
How to apply friction vector to acceleration in top-down 2D game?
I'm making a top-down view 2D RPG game, meaning the player can move in any direction on a 2D plane, and I'm trying to implement a somewhat realistic non-orthogonal acceleration/friction physics model ...
0
votes
2answers
51 views
How to convert velocity (Vector) to m/s (Scalar)
I have a variable called velocity which I get from a dynamic body in Box2D. It is the velocity of a pirate ship and when I add torque to the ship I want that to be proportional to the speed (m/s - ...
1
vote
1answer
34 views
Should I store local forward/right/up vector or calculate when necessary?
I'm working on an object picking and translation/rotation/scale gizmos system in my engine where you select objects and perform transformations on them in a 3d editor-like fashion (e.g. Blender)
In ...
0
votes
1answer
77 views
How to rotate a triangle towards the point in Qt?
I have an issue with items rotating.
I have a point and a triangle which needs to be rotated with its apex point towards the taregt point. The right side of the picture represents how it is should to ...
-2
votes
1answer
37 views
how to set in vector float x y coordinates [closed]
i am use eclipse java android i am try to projectile trajectory in my game like angry birds example here ...
0
votes
0answers
47 views
How to get the angle an object is travelling at
I'm trying to figure out how to get the angle an object is moving at, but have ran into a few problems. My player object is moved by rotating the entity left and right by using the left and right ...
1
vote
1answer
35 views
Vector out of range (Batch rendering & opengl)
So ive (tried to) implement a batch rendering system, and at the for loop the error pops up and I'm not shure what ive done wrong. Any suggestions to improve the system would be much appreciated. ...
2
votes
1answer
74 views
Ball's velocity vector, reflect against a point
I need to calculate the new velocity vector when the ball collides with one of the paddle's corners.
Let d be the velocity vector of the ball,
r the target velocity vector
and n the surface normal ...
1
vote
1answer
57 views
How to calculate a vector for multi-axis rotations from sphere coordinates?
I'm working on a SceneKit project in iOS, trying to rotate a sphere (representing a planet) so that a point at a given longitude/latitude coordinate is facing "forward" (i.e. that point moves to the ...
2
votes
1answer
47 views
Find your value between four values in a grid based on distance, Unity
Please note: Originally posted in stack overflow, redirected due to nature of problem.
I am making a procedural mesh game. I am trying to calculate the temperature for the player's current chunk by ...
4
votes
2answers
166 views
Movement with Vector Math
After reading This SO post on Vectors, I'm still pretty confused on how to use vectors to move my entities at any angle. The SO post assumes only 90 degree angles:
if up pressed:
direction = ...
1
vote
1answer
77 views
How to make an enemy projectile head to the player's position with constant speed
How can I dynamically set the movement speed of the X and Y of the projectile so that it moves at a constant speed when the projectile heads at the player's position? I know this has something to do ...
3
votes
4answers
98 views
Intersection of a Line and a Rectangle
I have to calculate the intersection of a line segment (represented by 2 points) with a rectangle.
For example:
Axis aligned rectangle corners: (0, 0) (100, 100)
Point 1: (50, 50)
Point 2: (50, ...
-1
votes
1answer
56 views
Moving vector shooting at other moving vector
The following code creates an accurate shot to be made at a moving target from a stationary position. (ie a tower or non-moving vector). It works GREAT, but I need it to consider the movement of the ...
2
votes
0answers
30 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 ...
2
votes
1answer
65 views
How do I create a rocket projectile that is “dropped”, then accelerates toward the enemy?
I'm making an Asteroids-like game. I've successfully implemented linear bullets.
Now I want to add some rocket-styled bullets, with a certain flight path:
The rockets should be "dropped" back first, ...
1
vote
1answer
44 views
How to find if an object is facing another object given position and direction as separate vectors
I found a very helpful post about exactly what I need here. It uses dot products to which is what I'm specifically looking for.
It talks about players facing monsters basically. They give a helpful ...
1
vote
2answers
77 views
Calculating the vector to catch a falling object
I have two objects in a three dimensional world. One is a ballistic projectile: that is, it is free-falling with some known gravitational acceleration. The other is a catcher that travels with ...
0
votes
1answer
48 views
In unity, how do I rotate a vector in relation to the player?
I am making a radar script in a unity FPS game project I am making for class. I already have a working example of a radar script that works in relation to the player's position. However the rotation ...
1
vote
1answer
52 views
Rotating a 4D matrix about the Y axis with an X-Z vector
I should mention that I'm pretty new to Matrices and will probably need a layman's answer to my question.
I have a 4D matrix which represents the rotation of an object in 3D space. I have a ...
0
votes
1answer
151 views
Unity3d - Transform rotation(angle) help
Im trying to rotate an object 90 degrees to the left but instead of rotating straight left it rotates 270 degrees to the right.
Here's the part of the code which controls the rotation:
...
1
vote
2answers
60 views
Clamp view direction vector to nearest axis
In JMonkeyEngine, given any view direction Vector3f instance, I'd like to get a new vector facing the nearest x or z axis (positive or negative), with y set to 0.
For example
[-0.99915564, ...
0
votes
1answer
43 views
Camera will not move between given points, stuck at first given point
[EDIT: Working code added]
[Original question]
I'm putting together a "raid cam" or "overview cam" for a given map in my shooter for an observing player to use to fly down a given preset path (to ...
3
votes
2answers
347 views
calculating torque from angular momentum considering inertia moment
so I am trying to determine exactly how much torque to apply to a 3d model to make it rotate at a particular rate.
I apply force from the location of each engine on the craft so if one breaks the ...
0
votes
1answer
42 views
Direct3D - Get screen coordinates for printing multiple text elements
I have a function that I use to print text PrintText(char* text) that stores the text to a vector, which is then displayed if the vector is not empty. I'm trying to figure out how can I correctly ...
0
votes
1answer
46 views
Space of Tangent and Bitangent Vectors
I have a really simple question I cannot be sure about the answer.
What is the space of tangent (T), and bitangent (B) vectors when we calculate them using vertex positions, and texture coordinates?
7
votes
1answer
133 views
Path following with Asteroids-like movement. Time to complete path
I'm currently learning about how to do this, but it's best to post the problem beforehand. (posting on Physics and GameDev, as you guys know your math)
It's quite difficult to explain. This specific ...
1
vote
3answers
203 views
2D Rendering Based On Y Coordinates
I'm trying to build an RPG worldbuilder. I have seperate classes for images. Like this.
Object1::Object1(int x, int y, CSDL_Setup *sdl_set, int *p_CamX, int *p_CamY)
{
X_pos = x;
Y_pos = y;
...
2
votes
1answer
128 views
Unity 3D - Rotate towards object with random offsets
Title is a little confusing, but let me explain:
I want to make the enemies look at the player, and shoot at him, with random precision, meaning that one time the enemy will shoot a little bit to the ...
1
vote
1answer
61 views
scrolling ruining bullet physics
the code below is the bullet class for my shooter game in pygame. as you can see if you run the full game (https://github.com/hailfire006/economy_game/blob/master/shooter_game.py) the code works ...
1
vote
2answers
165 views
Unity 3D - Confine a gun rotation within certain degrees
I am having troubles making my gun rotate up and down, and have limits, for example, I want the down limit to be 0 degrees, and the up limit to be 90 degrees.
Currently I can't figure out how to ...
2
votes
3answers
113 views
Unity - Check if object is facing Vector3 coordinates
I am having a hard time figuring this out, I want to have objects that move around randomly, and when they get new coordinates to move towards, face them, and then move.
Here's explained:
Target ...
0
votes
0answers
27 views
Finding vectors to create an inner border for a mesh
I'm looking to create an inner border for generated polygons, which function as provinces in my game. As an example:
I have the outer black vectors, that I use to generate the mesh for the ...
2
votes
1answer
87 views
How to calculate if a point is contained in rectangular camera viewport with rotation?
I am working with my camera, and am trying to improve it so that I can calculate if a world point is on screen, taking rotation into account. Currently, my camera rectangle is calculated as so:
...
1
vote
1answer
56 views
libgdx Vector.cpy question
Why do people use this:
public void set(Vector2 v) {
this.vector2 = v.cpy();
}
insted of just using:
public void set(Vector2 v) {
this.vector2 = v;
}
What I don't know that I should ...
0
votes
1answer
779 views
Unity3D Get object size in order to be used in Vector3 coordinates
I have a plane in Unity in 3D project, and I want to get its boundaries so I can use them in random function for getting Vector3 coordinates. Currently I am trying like this
GameObject ground;
void ...
3
votes
1answer
57 views
Finding coordinate in radius
Hello i have two points (Vector3) A and B. And have a radius r
How can i find a coords of point P in a circle by angle?
-1
votes
2answers
70 views
How to get a pleasant path accelerating to a point
I am having trouble moving an object to a target position with a maximum acceleration limit.
If i just accelerate towards the target the object will fly in a doughnut a few times before hitting the ...
0
votes
0answers
28 views
Making a node map with PNG alpha channels
I currently creating a 2d game that requires the usage of boats that travel from one country to another. The countries are individual objects with there own png. Nehow I've got the original map of the ...