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

1
vote
1answer
153 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
932 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 ...
2
votes
0answers
73 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
49 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
4answers
107 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 ...
0
votes
1answer
188 views

Controlling roll rotation when travelling along bezier curves [Unity3D]

I am currently working on implementing 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 ...
1
vote
3answers
167 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; ...
7
votes
1answer
3k 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
39 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
691 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 ...
2
votes
1answer
45 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
499 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
60 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
54 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
138 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 ...
0
votes
0answers
16 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
44 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
39 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
54 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 ...
-1
votes
2answers
62 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 ...
3
votes
1answer
52 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?
0
votes
0answers
21 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 ...
2
votes
1answer
4k views

Adding 2D vector movement with rotation applied

I am trying to apply a slight sine wave movement to objects that float around the screen to make them a little more interesting. I would like to apply this to the objects so that they oscillate from ...
4
votes
3answers
807 views

What is a direction vector and why should it be normalized?

I've been trying to get the hang of vectors and I read Wolfire's blog about linear algebra and I seem to understand most stuff except when it comes to storing a direction as a vector and using it by ...
-2
votes
2answers
51 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 ...
0
votes
1answer
38 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
0answers
44 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
75 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
42 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
76 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
26 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
76 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 ...
0
votes
1answer
47 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 ...
1
vote
1answer
39 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
47 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?
2
votes
1answer
65 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
54 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 ...
3
votes
1answer
109 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 ...
1
vote
0answers
39 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
688 views

multiply matrix by vector: what to do if need to change y-up to z-up?

I multiply a matrix with a position vector to get a new position, however, now I need to change my matrix from y-up coordinate space to z-up. Changing only the matrix won't work: how to apply the ...
3
votes
1answer
181 views

How to make an object stay relative to another object

In the following example there is a guy and a boat. They have both a position, orientation and velocity. The guy is standing on the shore and would like to board. He changes his position so he is ...
4
votes
3answers
6k views

How do I find a point given an angle and distance to it?

I'm working on a school project creating a tank team in the programming game Robocode. (It's a tank battle game with self-programmed bots, in Java). I'm programming a scout bot that scans, finds ...
0
votes
1answer
167 views

Relative Position/Rotation calculation

I have 2 objects each with a 3x3 Matrix (Orientation) and a Vector3 (Translation). Both are relative to world coordinates. How do I calculate the position and orientation of object B in relation to ...
26
votes
2answers
2k views

Calculating the rotational force of a 2D sprite

I am wondering if someone has an elegant way of calculating the following scenario. I have an object of (n) number of squares, random shapes, but we will pretend they are all rectangles. We are ...
4
votes
3answers
2k views

Given an angle for an arrow, how do I find its X and Y velocities?

I want to fire an arrow toward the mouse location. X0 = the players X location X1 = the mouse X location Y0 = the players Y location Y1 = the mouse Y location I want to make a method which takes ...
0
votes
0answers
15 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
291 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
97 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
981 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
147 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 ...