A mathematical concept that can be used to express position, direction or velocity and which can simplify or outright trivialise spatial problems.

learn more… | top users | synonyms

3
votes
2answers
1k views

Spritekit - gradually apply force vector in different direction (space ship turning)

I have a space ship that I'm applying a force vector to using a joystick for control. I would like this to smoothly fly around when I'm switching directions.. Exactly like minisquadron if you've ...
1
vote
2answers
849 views

Detecting walls or floors in pygame

I am trying to make bullets bounce of walls, but I can't figure out how to correctly do the collision detection. What I am currently doing is iterating through all the solid blocks and if the bullet ...
0
votes
2answers
52 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
0answers
39 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 ...
-1
votes
0answers
22 views

How to rotate Vector3 in OpenTK?

I'm completely new in OpenGL and OpenTK world so I want to ask the noob question. I'm working on a 3D application in visual basic and I want to rotate the camera around the "0,0,0" position without ...
0
votes
1answer
47 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 ...
0
votes
1answer
60 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
15 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 ...
2
votes
1answer
206 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
51 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 ...
3
votes
2answers
312 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
83 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 ...
5
votes
2answers
115 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 ...
1
vote
1answer
30 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 ...
3
votes
1answer
316 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
2answers
44 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 - ...
2
votes
1answer
37 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 ...
8
votes
2answers
4k views

How do I calculate collision response between a sphere and a plane?

I'm trying to create a simple 3D game and need to constrain the player within the limits of the game world. When the player hits the sides of the world I want the player's ship to bounce off slightly. ...
1
vote
1answer
33 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 ...
-2
votes
1answer
33 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 ...
1
vote
2answers
2k views

How can I find the perpendicular to a 2D vector?

I'm making a top down game where the player moves forwards towards the position of the mouse cursor. As part of the player's movement code, I need to determine a vector that is perpendicular to the ...
2
votes
1answer
67 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 ...
0
votes
0answers
43 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
34 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. ...
1
vote
1answer
52 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 ...
4
votes
2answers
157 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
72 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
97 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, ...
7
votes
1answer
127 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 ...
0
votes
1answer
45 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?
-1
votes
1answer
55 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 ...
15
votes
5answers
8k views

Do I need the 'w' component in my Vector class?

Assume you're writing matrix code that handles rotation, translation etc for 3d space. Now the transformation matrices have to be 4x4 to fit the translation component in. However, you don't actually ...
1
vote
2answers
75 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 ...
6
votes
4answers
2k views

How do I restrict the movement of a point to within a radius of another?

I have a situation where a sprite's center point needs to be constrained within a certain boundary in 2D space. The boundary is circular, so the sprite is constrained within a radius. This radius is ...
2
votes
0answers
27 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
64 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
43 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 ...
0
votes
1answer
45 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
138 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
57 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 ...
0
votes
1answer
40 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
4answers
161 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
3answers
199 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; ...
1
vote
1answer
59 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 ...
2
votes
1answer
109 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
3answers
699 views

Create random polygon shapes

I want to make a random shape made out of points. I want the points to create a polygon shape. Is there a clever way to create a random shape like this? Im thinking going throug X points and giving ...
1
vote
2answers
153 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
103 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 ...
1
vote
1answer
164 views

Raycast Flashing problem

Can anyone tell me what is wrong with me code? If you can see, whenever the player is in range of the raycast, the enemy turns red. But for some reason, even when the player has meet the requirement ...