A mathematical concept that can be used to express position, direction or velocity and which can simplify or outright trivialise spatial problems.
-1
votes
1answer
51 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
25 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
55 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
35 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
65 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
32 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 ...
0
votes
1answer
35 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
45 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
46 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
42 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 ...
2
votes
1answer
193 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
33 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
44 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?
6
votes
1answer
118 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
178 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
69 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
46 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
106 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
66 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
18 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
59 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
40 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
202 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
53 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
65 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
24 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 ...
1
vote
1answer
43 views
Why can't CSS Sprites handle vectors?
Almost all the documentation available either says that "sprites are bitmaps" or that "css sprites must be bitmaps". Is there a specific reason for this? Is it, in fact possible to create a css sprite ...
0
votes
1answer
63 views
Would Raycast suffice for a game clock based on sun position?
I need help with some logic in my script. I created a dynamic day/night cycle that works fine in itself, but I want to add a game clock that works off the initial position of the sun (Directional ...
0
votes
0answers
58 views
how to move an object to the mouse in Java
I have just recently started using Java, literally 2 days ago, and I have run into an issue. While I have been easily able to figure out most of the syntax and methods, because I have used multiple ...
1
vote
2answers
78 views
Malformed/Pixelated Vertex Normals
I am trying to generate vertex normals for a given triangles/vertices list with the following code:
**BASE METHOD:**
private void CalculateNormals()
{
for (Int32 i = 0; i < m_Meshes.Count; ...
1
vote
1answer
43 views
Unable to achieve two finger panning
I'm looking to achieve a two finger smooth pan system in my project.
However, the code below does not work, any interaction with the screen doesn't change to position of the camera.
I am unsure where ...
0
votes
1answer
168 views
Unable to stop navmeshagent for rotation before moving
I'm trying to get the NavMeshAgent to rotate before calculating a path and proceed walking.
I stumbled upon a thread that said this can be done by manually rotating the object first.
However, I am ...
0
votes
1answer
34 views
Unable to get object to rotate to looked position?
I'm trying to get an object to smoothly rotate towards a clicked point in my terrain.
However, my code only yields jittery movements in the other direction.
Any help will be greatly appreciated.
...
0
votes
1answer
91 views
Working but flawed bullet spread (vector math)
I'm trying to implement random bullet spread into my game, and I've managed something that works, but is consistently flawed.
The spread doesn't vary depending on the distance the mouse is from the ...
1
vote
1answer
42 views
Rotate an objects velocity
I have a collision system (in 3D but for the purpose of the question assume 2D) where I want to calculate the new velocity (stored as a vector) after a collision.
What I have is the velocity of the ...
1
vote
1answer
52 views
How do I convert two vectors into a bounding box with 8 vertices?
I created two vectors named bboxmin and bboxmax using the functions
vector3
applymin_xyz() and vector3
applymax_xyz().
How do I convert them to 8 vertices,so I can test cull with them?
0
votes
1answer
58 views
Controlling the movement of player by sprite using Mouse
I want to move the player by pressing down on the mouse and moving around by dragging. The player won't move to the position of the mouse. Instead it should be relative to the players current ...
-2
votes
2answers
68 views
In XNA, how do I make a sprite move towards another?
I am making a shoot-em-up with a player-controlled sprite with a gun:
I have most of the game working, but I have gotten to the point where I need to load in the enemy characters and make them move ...
3
votes
1answer
141 views
Endless Running Game - Changing Lane Function in JAVA
I am developing a kind of vertical endless running game, where the character has 4 possible lanes to be in. I am using libGDX and want the character to change lanes by adding a horizontal velocity to ...
0
votes
4answers
128 views
How to check distance between two different vectors?
So I have a very basic racing game, where I would like the car to stop once it hits the finish line. Respectively when the distance between the car and the finish line hits or goes under 0 the car ...
1
vote
0answers
45 views
Find camera coordinate of vanishing point
Given a vector and a camera (position, angle, up vector, field of view, etc), how would I find the vanishing point of the vector in camera space?
2
votes
1answer
68 views
How to prevent bullets from passing right through entities?
(sorry for bad english)
I'm making 2D arcade game. I write all of physics stuff myself. The problem involves bullet behaviour. Imagine bullet flying towards some entity. If the bullet's velocity is ...
0
votes
1answer
59 views
Resultant Vector Of Circle Line Collision
For my game I need to have a circle collide against a wall and bounce off in the appropriate direction. I've looked around for a while and haven't found a good solution to my problem. I have a diagram ...
0
votes
0answers
18 views
Screen coordinates to letterboxed view
So I have letter boxing working properly (it's not really important but I'll post that bit of code too), but I'm trying to figure out the point/vector arithmetic for translating (projecting) screen ...
4
votes
1answer
301 views
Does vector transformation order matter?
Theoretical question - imagine a car object. There are two (or more) 'forces' acting on this car, these forces will affect where the car will steer. But the forces are calculated using car's location ...
0
votes
1answer
108 views
How do I rotate a cube around an axis, relative to the camera view?
I want to be able to rotate a cube, either by
dragging vertically to rotate it around the Y-axis, or
dragging horizontally to rotate it around the X-axis.
However, when the camera is rotated 90 ...
7
votes
2answers
2k views
In Unity, why is adding a Vector2 and a Vector3 ambiguous but assigning isn't?
Given the following two vectors:
Vector3 v3 = Vector3.one;
Vector2 v2 = Vector2.one;
This line is ambiguous:
v3 += v2; // Unity reports dimension ambiguity
whilst this assignment isn't:
v3 = ...
0
votes
1answer
213 views
Unity forward vector flips when upside down. Mario Galaxy style gravity, bad rotation?
This is a question that I think is best to explain visually, so I will do my best to be succinct here.
What I am trying to do:
Allow the player to run about a world that is spherical, not a flat ...
1
vote
2answers
110 views
How can I calculate the orthographic projection needed to encompass an object with arbitrary rotation?
So I need to set up the dimensions of a orthographic projection that will encompass the entirety of a bounding box when viewed from any arbitrary position.
That's an eye (programmer art); and the ...
0
votes
0answers
162 views
Kinect wrist yaw angle calculation
I am trying to calculate the wrist yaw for the Kinect. However i don't know enough from Vector algebra to be able to find these correctly.
Currently i have been using the following code to hopefully ...