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
79 views

How can I rotate an object based on another's offset to it?

I have a 3D model of a turret that con rotate around the Y-axis. This turret has a cannon that is significantly off the center of the object. I want the cannon, not the turret, to aim at a specified ...
0
votes
2answers
41 views

2d starship combat, hit chances based on bearing and speed (vector)?

Thinking about a 2d strategy game, where you move your starships turn by turn and fire guns at each other. Instead of the traditional approach of "range" lowering hit chances, im thinking about some ...
0
votes
1answer
33 views

Ball bounce in 3d

I cannot get my bounce equations right. I have 2 spheres, that can colide at any angle. One is forever stationary, other one is moving though the space. I have X,Y,Z speed of the moving ball and a ...
0
votes
2answers
43 views

Rotating Object parallel to other object

I try to rotate objects in the same direction as a reference object. Normaly this would be easy: object1.rotation = reference.rotation But the same rotation can be expressed with different ...
0
votes
0answers
12 views

Calculation of momentum and angular momentum after a kinetic impulse at a certain location

In a space game, how does one calculate the rotation and velocity of a craft, after it got affected by a kinetic impulse. I've drawn a sketch to illustrate my problem. The kinetic impulse could be a ...
5
votes
2answers
87 views

Scrolling background after firing projectile

I have a projectile which I fire using the mouse coords as the direction vector which I scale with a velocity vector and add a gravity vector to complete this simple simulation. I want to scroll the ...
-1
votes
1answer
58 views

Smoothly moving an object sideways by a certain amount when a key is pressed Unity C#

I basically want to have the user press A once without holding it down, to smoothly move the player to the left. I would like to make the player move to the left by -12. So he would end up going from ...
0
votes
0answers
33 views

Calculating Jumps in Unity3D

I'm currently learning Unity, and having a hard time when making a Character jump.So I can jump and move fine, but most of the time is just: Search for tutorial, understand a few things, adapt code ...
0
votes
0answers
21 views

Find pairs of the closest position in list of positions

Given an array of positions, what would be the fastest algorithm for finding pairs that are closer to each other than to any other object?
0
votes
1answer
22 views

How to rotate to look at target

I have found other questions like this, but none seem to quite cover the situation I have. I am using DirectX 11 I have an object that has: Position (vector) Rotation (quaternion) View angle (pitch,...
1
vote
1answer
39 views

Drawing & transforming matrices upwards

I'm drawing a hierarchy of 3D objects in C# XNA where each objects has a transform that holds position, rotation and scale. I get my expected results If I draw my objects from my root node in this ...
-1
votes
1answer
28 views

Changing a direction Vector with Euler angles

It seems like an easy problem but I somehow didnt got to the solution. I need the Maths to change the Vector based on Euler angles. Example Problem: I have an direction Vector- for example: Showing ...
0
votes
1answer
47 views

Clamp point to triangle for sphere collision

I'm having some issues clamping a 3d to barycentric triangle. I've searched for some time now and keep seeing the same results, that (u,v,w) should be clamped between 0 and 1. But when I clamp those ...
-1
votes
2answers
64 views

Inconsistent speed when using Vector2.Lerp

I have tried to build a point and click mechanism in unity using Vector2.Lerp(current_position,new_position,Time.deltatime) But what I observed that the game object is moving at varying speeds ...
1
vote
1answer
44 views

Find the closest point on a ray

I've got a ray defined by P1 and P2, and then a target P3, and I want to find P4. How do I go about this? I've come to understand that I should use vector projection, but I can't get it to work. Any ...
0
votes
1answer
37 views

Roll a 6DOF camera to a plane direction

I've been working on a 6DOF camera that I want to be able to "align" to any walls orientation to make it feel like I'm standing on that wall. I'm thinking it's a simple matter of finding the right ...
0
votes
0answers
15 views

Adjust Object Velocity depending on Rotation

I am building a vehicle handling line in hyperPad, with no luck. I have a "gas pedal", and the vehicle. I can use add, subtract, multiply, divide, mod, get Rotation, get Velocity and set Velocity. ...
3
votes
2answers
199 views

C++ alternative to vector for arbitrary number of objects using pointers

I'm working on a prototype 'life simulation' game which incorporates any number of objects / entities that may exist in the game. Up until this point I had been working with vectors of the objects, ...
2
votes
3answers
84 views

How can I rotate the camera for a player walking around the surface of a sphere? [duplicate]

I'm making a 3D game where the player can walk across the surface of a planet. I am having a problem correctly rotating the camera's frame of reference, so that the camera is oriented correctly ...
1
vote
1answer
37 views

Rotation smoothing with Slerp snaps to center when switching between different destination vectors

I'm making a 3D space shooter in Unity (think Star Fox). The ship, when I move it around the map, should rotate slightly (smoothly) in the direction I'm controlling it. I have smoothness mostly ...
0
votes
1answer
38 views

How to place text centered on the player? XNA

As I can make a text of the size of this, it is centered taking reference of the player? Right now the following happens: I want: code: spriteBatch.DrawString(Font, player.Name, new Vector2(player....
1
vote
1answer
25 views

How to calcolate moving vector of object by its rotation degress in 2d

i have object in game which is rotating when i move my joystick , now i need to calculate its movement vector by its rotation the object always moving forward and controlled by the joystick , the ...
0
votes
0answers
27 views

Keeping track of space objects: enemies, projectiles, players

I have a Vector called spaceObjects of type SpaceObject that contains all types of SpaceObjects: Heros, Projectiles, and Enemies. I've added all these to this one Vector because I'm passing it all ...
1
vote
3answers
58 views

Calculate target angle to a certain Vector

I'm developing a 3D game in LWJGL. I have a player class and a monster class and I need the monster class to chase the player when the player is within a certain distance. For that I have the monster ...
0
votes
0answers
38 views

How do I normalise vertex normal vector in C#?

I have a binary file format with vertex positions, normals, UVs and weights. It all works fine, except I can't understand how to get vertex normals out of it. V normals are recorded as bytes1 (one ...
3
votes
1answer
72 views

Garry's Mod gamemode scripting (lua) - How do I tell if an object is inside a hollow cylinder?

I'm fiddling about with gMod trying to make a gamemode where you have to throw a piece of cake into a cylinder that spawns on the map. This is the code I'm using to spawn the cylinder: local ent = ...
0
votes
1answer
48 views

2d animation on html5 canvas using a vector and speed

Im moving a starship from one location to the other. In creating a vector, normalize and magnitude it. Lets assume my vector looks like this Vector x: 156, y: -90, m: 180.0000000546, ...
0
votes
1answer
17 views

Lengthen Line (bidirectional) - crossing zero line

I'm trying to lengthen a line, by a certain amount. I want to apply the modification to both points on the line, expanding it in both directions. without moving it from it's current position (center ...
1
vote
1answer
34 views

Pitch/Yaw in circle causes undesired Tilt [duplicate]

I've made my own Camera object, with a forward vector as well as a up vector. I happen to be programming in Android using OpenGL ES 2.0 but I think this question is relevant to all frameworks, it ...
0
votes
1answer
29 views

MonoGame - scale down a sprite from the middle

I want to animate a texture's scale. First it's scaled up to 10, and then it gradually goes down to 1. However the texture is drawn at Vector2(0, 0) so it doesn't animate as I had imagined it would - ...
1
vote
1answer
91 views

LibGDX: How to make something like vector rotation sensor with accelerometer and compass values?

So I've tried the vector rotation sensor using the Android API and it works perfectly to do what I want, but LibGDX does not support this sensor. I've been searching and it seems like I can do the ...
0
votes
2answers
63 views

Unity3D: Find Raycasthit direction

I'm trying to make a Billiard game and I wanna calculate the direction on which the Cue Ball(white ball) will be moving after it hits another ball. As you can see I wanna calculate the angle/...
0
votes
0answers
21 views

Javascript applying thrust to my inertia

I'm using http://www.mathguide.com/lessons2/Vectors.html#combining as a reference. Their magnitude values are too large for my pixels so I'm decreasing by a factor of 100 - so the 30 magnitude becomes ...
1
vote
1answer
53 views

Computing how fast a vector should go toward certain direction

I have two object in space, one has velocity (object A) with fixed magnitude, and one is static (object B). every timestep, I add to object A's velocity a vector which direction is object A to object ...
1
vote
1answer
74 views

Clamp camera view angles relative to moving object

I have a camera attached to an entity that moves in a circular pattern around a fixed center position. I am attempting to clamp the rotation of the camera such that it can only look inward toward the ...
0
votes
1answer
64 views

Change sprite angle on sloping ground

I have a problem here with GameMaker built-in physics environment.My player is designed to be on a skateboard. I want my player to rotate its sprite, according to the kind of fixture(up or down slopes)...
1
vote
2answers
61 views

Move to specified coords - libgdx and java

So I am making my bullets go to a point and travel further. Only its acting really really weird. Its like its thinking that the 0,0 location is at the top left instead of the bottom left. This is the ...
0
votes
1answer
31 views

Turning x and y difference between two points into a projectile moving between them at a fixed speed

In a libgdx project of mine, I have two units on a 2d field who want to fire at each other. They both know the x and y distance to each other by subtracting their enemies position from their own: ...
1
vote
0answers
110 views

Polygon 2D collision response- How do I find the correct edge a polygon hit?

Hey guys I've been seriously stressed out by this, so please go easy on me. My goal is to reflect a bullet (polygon) off of another polygon, and find the edge the another polygon, A (the bullet), hit....
1
vote
1answer
120 views

How to align a hint arrow to point along a path?

I am using CalculatePath and trying to use path.corners in order to give user a hint for path, that where should he lead next. I am using first two instances of Vector3 of path.corners. Lets call ...
0
votes
0answers
29 views

Vector and aabb collision [duplicate]

Im having trouble with bullet collisions for a 3d game. I've seen many solutions but they either don't work for my case or are way to complicated. Can someone explain in a pretty simple way how to ...
1
vote
0answers
94 views

Moving along the surface of a mesh?

I'm trying to replicate the movement in this game: https://www.youtube.com/watch?v=OcvD8BXars8 The players ship along with all other game elements move along the surface of a mesh. I've tried ...
0
votes
0answers
52 views

Unity C# - The object of type 'Object' has been destroyed but you are still trying to access it

I have a cube on a plane and I'm tring to move it to certain locations. I've baked the area and added a navmeshagent to the cube. My moving script for the cube looks like this: using UnityEngine; ...
1
vote
1answer
115 views

Java Distance between two Vector positions never 0

I have a Player moving, but when the player reaching the destination it should stop. But problem is that distance never return 0. It starts printing this: 0.9672514210000003 End by this and then ...
1
vote
2answers
156 views

Unity Vector3.Angle() direction

I have a space fighter AI. I need to determine how to pitch, yaw and roll the craft to aim at the target. My current solution: To obtain the Yaw angle to position the target above the fighter, here ...
3
votes
3answers
113 views

Does AddForce continue to add force indefinitely?

Does the AddForce method continue add velocity to an object forever? Does it need to be limited by another line of code? Sorry if it is too broad or too simple; I am completely new to programming and ...
0
votes
1answer
205 views

Unwanted roll when rotating camera with pitch and yaw

I have a quaternion class implementation, and when I apply this class to my objects all gone right (rotations), but I have a lot of troubles with the camera. I've been searching a lot trying to solved ...
2
votes
1answer
60 views

2d vector flips during rotation

I have a 2d game (C++ and SDL) and I want the player object rotate to follow the mouse. The player object and the mouse location are both stored in 2d vectors. In order to have the player's rotation ...
1
vote
0answers
62 views

How to make this vector field animation

This screenshot is from Windows app called MyRadar by ACME AtronOmatic LLC. I found their wind direction animation to be very visually appealing and was wondering if anyone knew how to create this ...
1
vote
1answer
126 views

Shooting Projectiles

I am using cocos2D-x and am trying to achieve the effect of enemies going past and shooting projectiles at the player who is moving around the screen. I am using the code below, which is based on this ...