My First question on here so be kind...  I am writing an aerodrome simulator in as2, I need to calculate a turn rate between 2 points so that the aircraft turns nicely. I have tried a few things but the maths forums on this type of subject use complex calculations and I struggle to understand them. I need an answer in a more variable specific format.  I have the XY of both tile and target, the speed of tile and the distance of target from the tile.    I use vector math, with frame time calculations to move the tile. I already have a good calculation for shortest turn i.e. left right.  I need to calculate the turn rate required to go from point a to point b in a nice fluid motion and turn the tile/aircraft in a nice fashion.  Any help would be much appreciated.
104132
I have a sprite that moves from waypoint to waypoint. It turns to face its velocity vector, but not instantly (there's a rotation speed).  The problem I'm having is, from one direction to another, the sprite will often turn in wild, unnecessary ways instead of appearing like you might expect a car to appear (turn such that the minimum delta in angle occurs).  Right now I'm using the following formula to calculate the rotation float for the current velocity:  MathHelper.PiOver2 + -Math.Atan2(anotherVector.Y - vector.Y, -(anotherVector.X - vector.X));   And then I lerp the current rotation by the new rotation by the rotation speed (10f):  rotation = MathHelper.Lerp(rotation, targetRotation, 10f * (float)gameTime.ElapsedGameTime.TotalSeconds);   But unfortunately, it's causing the sprite to spin in wild directions before reaching the correct angle. Any suggestions?
59672
I want to randomly generate reachable platforms on the fly for a 2D game.  Right now, I am just creating platforms at random x,y positions.  Only 4 platforms can exist at once, so once the 5th one is generated the 1st one is removed (fifo).  So, I want to ensure that the player can jump from his current platform to at least one other at any given time.  I was thinking of using some variant of the distance formula to calculate the location of the next platform being generated.  I was hoping someone could help me out with the formula for calculating the next platforms possible x,y positions.  The player variables I am assuming will be important are speedX, speedY, and gravity.  From here, I should be able to calculate the maximum distance to plug into the distance formula.    However, I am thinking that some variation of the distance formula that contains a variable for slope would be better in my case.  I want to ensure that the player will never get stuck on a platform with no where it can jump.  Also, I want to ensure that platforms aren't generated on top of each other.  Formulas/images/code are a huge plus.  Here is how jumping is currently working.  Field speedY:Float = 4 Field GRAVITY:Float = .05  Method Update:Void()     If KeyDown(KEY_SPACE) And not jumping Then         dy=-speedY         jumping = true     EndIf       If jumping         dy += GRAVITY         local tempY:Float = y + dy         y = tempy     Endif End Method   Edit: I now understand that the formula is just the displacement of basic projectile motion.     Except, in my case, we don't care about cos/sin because the angle will always be the same.
69574
Rephrasing     (one year later)    (original question is below)   Apparently the original question wasn't clear, or nobody knows an answer (or both).  So I will try to rephrase it.   Look at your favorite .  This question asks for a labeling system for the points.  Of course we could draw the grid on the Poincare disk, and use real numbers (the (x,y) coordinates of each point), but in practice that would raise all sorts of precision issues that could surely be avoided if one had a proper symbolic coordinate system.  You shouldn't need real numbers if you're staying on grid points!  Just like (2,3)+(0,1) is trivial to do by hand (or in your head) for the square grid, we'd like some form of symbolic coordinates (i.e. consisting of finite sequences of symbols) for a hyperbolic grid, in which simple operations on small grid vectors are similarly easy.  If you take some sequence of left and right turns in a hyperbolic grid city, what should you keep track of in your head so you can take the optimal route back to your starting point?  In a Euclidean square grid, it is {(int)X, (int)Y, (enum)direction you are facing}, and we all know how to use this.  Is there any hyperbolic grid where this question has a nice answer?    Original Question  If we consider the Euclidean plane, then a square grid works well with using two integers (the coordinates) as a representation for vectors that lie on the grid.  Does anybody know of a similarly nice representation for working in the hyperbolic plane?  Desirable features of any such system:  $-$ It should be easy to add two vectors.  $-$ It should be easy to see if two vectors are the same.  $-$ It should be easy to see if two vectors are close.  $-$ It should be easy to rotate a vector by an angle that is a symmetry of the grid.  $-$ Every point in the plane should be near some vector. (The grid shouldn't have large empty regions.)   Note that "addition" using continuous coordinates would most naturally be defined in terms of parallel transport, and it is neither commutative nor associative.  On a grid, however, the issue of orientation needs to be addressed differently, since parallel transport along arbitrary grid vectors will introduce rotations that are not a symmetry of the grid, so to remain on the grid, addition will need to be defined using something other than parallel transport.  Since hyperbolic grids have an exponential number of points (as a function of distance from the origin), our symbolic coordinates will need to have a length proportional to the length of the vector.  Don Hatch has a web page which gives some .  ("Easy" means an efficient algorithm that is doable by hand, like how the algorithms for addition and subtraction using the standard digit-sequence representation of integers can be used for the Euclidean square grid. Using hyperbolic functions of real numbers, always keeping track of enough digits to identify the nearest grid point, does not count as easy!)    Addendum: Many readers seem to be disturbed by a little voice saying "But vectors don't make sense in the hyperbolic plane!": What that voice is really saying is that the hyperbolic plane doesn't give you all the nice properties you are used to in Euclidean space or in vector spaces.  So if you define vectors as objects having specific properties you are used to (such as having a direction that is unaffected by parallel transport), then that definition may not correspond to anything in the hyperbolic world.  You could use the term isometry, but that is typically a fixed mapping from the space to itself, and in the hyperbolic plane the isometry corresponding to a vector would depend on the starting point. (However, isometries will be central to any solution, I assume.) And a geodesic is a fixed path within the space, no different from a hyperbolic line or segment.  The paper  offers one solution.  offer another.  I deliberately leave them undefined in this question, as I am looking for any workable system.
70736
Anyone know the formula used to control the movement of a simple tank-like vehicle?  To 'steer' it, you need to alter the force applied the left and right "wheels".  Eg.  1 unit of force on both wheels makes it go forward.  -1 units of force on both wheels makes it go backwards.  Apply more force to one wheel than the other and it turns.  How would you calculate the amount of force needed on both wheels to turn the tank a certain number of degrees either way?  Or am I thinking about this in the wrong way?  edit: As William Keller mentioned I missed out the speed of the tank.  Assume 1 unit of force on both wheels moves the tank forward at 1 unit per second.  For anyone who's interested, I just found this thread on gamedev.net:   Another thread:   It turns out the key to finding the formula was just knowing the correct terminology ("skid steer") :P
15100
Consider a plane $\mathbb{R}^2$ and an affine transformation $T: \mathbb{R}^2\to \mathbb{R}^2$ that maps points $A,B,C$ to points $A',B',C'$ correspondingly. We know that $A,B,C$ are not on the same straight line and so $T$ is determined uniquely. Given an arbitrary point $M$ how to find $T(M)$?  Basically, I'm trying to write a program that takes as input 14 numbers—the coordinates of the points $A,B,C, A',B',C',M$ and outputs two numbers—the coordinates of $M'=T(M)$, provided $A,B,C$ are not on the same straight line. How should I proceed?
28597
I need to make a cartesian plane for plotting the straight line joining the points (-3,1) and (6,-2). This is a very simple cartesian plane plotting. When I looked at the manual for tikz the graphics for cartesian planes are for more advance plotting, and what I need is very simple.  Something like this:
101106
I am creating a Random Math Engine using the BGE and I am wondering how I can do mathematical operations between two properties. Example: "Property 1 + Property 2" and then it would output the answer in text when you hit "A". But I don't know how to add/subtract/multiply/divide properties together.
70064
I'm having trouble understand the concepts for this problem. Here's the problem:     A block is placed on a plane inclined at angle $\theta$. The coefficient of friction between the block and the plane is $\mu = \tan \theta$. The block is given a kick so that it initially moves with speed $V $horizontally along the plane (that is, in the direction perpendicular to the direction pointing straight down the plane). What is the speed of the block after a very long time?   We can see that $F_x = mg\sin \theta - mg\cos (\theta )\mu = 0$, if we gave the block an initial velocity along the plane, it should be subjected to a friction force opposite its velocity, where $f = mg \cos \theta \tan \theta = mg\sin \theta$   This however, is the answer my book gave:     The normal force from the plane is $N = mg \cos \mu$. Therefore, the friction force on   the block is $N = (\tan \mu)N = mg \sin \mu$. This force acts in the direction opposite to   the motion. The block also feels the gravitational force of $mg \sin \theta$ pointing down the   plane.   Because the magnitudes of the friction force and the gravitational force along the   plane are equal, the acceleration along the direction of motion equals the negative   of the acceleration in the direction down the plane. Therefore, in a small increment   of time, the speed that the block loses along its direction of motion exactly equals   the speed that it gains in the direction down the plane. Letting v be the speed of   the block, and letting vy be the component of the velocity in the direction down the   plane, we therefore have $$v + vy = C$$   where $C$ is a constant. $C$ is given by its initial value, which is $V + 0 = V$ . The final value of $C$ is $V_f + V_f = 2V_f$ (where $V_f$ is the final speed of the block), because the   block is essentially moving straight down the plane after a very long time. Therefore,   $2V_f = V \rightarrow V_f = \frac{V}{2}$   I don't really understand what this is trying to say. The bolded part is what's giving me problems. I think it just may be poorly written, I think I need a clearer explanation.
21997
I am having some issues with trying to detect collision of two isometric tile.  I have tried plotting the lines between each point on the tile and then checking for line intercepts however that didn't work (probably due to incorrect formula)  After looking into this for awhile today I believe I am thinking to much into it and there must be a easier way.  I am not looking for code just some advise on the best way to achieve detection of overlap
79987
In the attached , I have a representation of a airplane/jet fighter (cube scaled at one end to indicate direction of flight). I am using torque to steer, and adding Linear Velocity along a local axis for thrust/brakes. What I want to know is how to clamp the velocity along the plane's local axis so when the plane steers, it does not simply keep flying in the direction that is was before it turned. I would prefer a solution with logic bricks, but if that is not possible, python would be acceptable. (it just needs to keep a speed relative to how long the thrust/breaks have been held no mater which direction it is pointing.)
79472
Well I have a simple 2D game where all positions are defined by and X and Y coordinate.  There are objects moving at a constant velocity. And a turret fires a bullet at the X and Y coordinates of the object. By the time the bullet goes to the desired area, the object has already moved.  So i need to adjust the X and Y target positions for the turret to shoot at taking into account the bullet speed and object speed.  Here's an image showing the problem.
34208
I have 3 points on my screen:  a = a point which is (c.x, 0) makes a line pointing straight up b = a user input touch, can be anywhere on the screen c = a moving object         a _______.________ |      |       | |      |       |  |   b  |       | |  .   |       | |   \  |       | |    \ |       |  |     \|       | |      | c     | |______._______|   I have drawn some lines so that you can see the vectors.  I want to be able to get the angle between a and b. I have tried this, but it doesn't work, does anyone know what I'm doing wrong?:  //v1 moving object float boxX = this.mScene.getLastChild().getX();  float boxY = this.mScene.getLastChild().getY();  //v2 user touch float touchX = pSceneTouchEvent.getX(); float touchY = pSceneTouchEvent.getY();       //v3 top of screen float topX = boxX; final float topY = 0;  float dotProd = (touchX * topX) + (touchY * topY);  float sqrtBox = (touchX * touchX) + (touchY * touchY); float sqrtTouch = (topX * topX) + (topY * topY);  double totalSqrt = sqrtBox * sqrtTouch; double theta = Math.acos(dotProd / Math.sqrt(totalSqrt));   The answer I usually get is between 0 and 1. How do I fix this so that I get the angle in degrees?
64619
Question: Find the vector equation $r(t)$ for the line through the point $P = (-1, -5, 2)$ that is perpendicular to the plane $1 x  - 5 y + 1 z = 1$. Use $t$ as your variable, $t = 0$ should correspond to $P$, and the velocity vector of the line should be the same as the standard normal vector of the plane.  This one is really giving me a hard time.  I know that to find the plane perpendicular to the line I can use the vector n between two points on the line and and the plane.  I cannot wrap my mind around how to reverse this process, particularly because the plane is equal to 1 and not zero.  Any help would be greatly appreciated.
68506
Here is the situation.  I have hexagonal board,and a unit on it,with speed or move value 4.Diffrent terrain has a diffrent cost.When i click on the unit,game should show me a move range.  My solution was to check each  hex in range of 4,with A* pathfinding,and if path cost was less than 4 then this hex was in range.Finally game nicely show me range of that unit.  My question is:   Is there other solution to search for range on hex grids or square grid,because even if i am really proud of what i did in my solution,i think,it is a little to exaggerated?:))  What make me ask this question?I noticed that when unit speed is 4 or 6 or even 8,time to computing range for my computer was really good,but when speed was 10 and more i noticed that i needed to wait few second to compute.Well in real games i rather dont see something like this and my A* pathfinding is rather well optimized,so im thinking that my solution is wrong.  Thanks for any replies.
42365
OK so if your game rolls lots of dice you can just call a random number generator in a loop. But for any set of dice being rolled often enough you will get a distribution curve/histogram. So my question is there a nice simple calculation I can run that will give me a number that fits that distribution?  E.g. 2D6 - Score - % Probability  2 - 2.77%  3 - 5.55%  4 - 8.33%  5 - 11.11%  6 - 13.88%  7 - 16.66%  8 - 13.88%  9 - 11.11%  10 - 8.33%  11 - 5.55%  12 - 2.77%  So knowing the above you could roll a single d100 and work out an accurate 2D6 value. But once we start with 10D6, 50D6, 100D6, 1000D6 this could save a lot of processing time. So there must be a tutorial / method / algorithm that can do this fast? It is probably handy for stock markets, casinos, strategy games, dwarf fortress etc. What if you could simulate the outcomes of complete strategic battle that would take hours to play with a few calls to this function and some basic maths?
84942
I'm trying to make whenever an arrow is shot it will fly at double the speed without falling. The no falling part was easy, simply did execute as @e[type=arrow] run data merge entity @s {NoGravity:1} and that did the trick.  The other part is the real problem. As I understand, I'd have to    execute as @e[type=arrow] store success entity @s Motion double somehow double that value run data merge entity @s {Motion: (whatever I got earlier) } on that arrow   I can store the data all right, but the problem is I am completely oblivious of how to double that, fetch, and merge value simultaneously.  I've considered creating an individual score for each values and doubling them since that's the only way I know, but I genuinely couldn't understand how the scoreboard command works.
46047
I want a game object to turn and look towards where the mouse was clicked (in world space).  It works well when considering all 3 dimensions, but I really only care for the plane formed by the x and z axis, not the y.  I've tried to fix this by setting the y of the directionTarget to the y of the object's position, but that gives weird results.  My code looks like this:  Quaternion rotationTarget;     float rotationLerpProgress;     float rotationLerpDuration = 1f;      // Use this for initialization     void Start ()     {      }      // Update is called once per frame     void Update ()     {             if (Input.GetMouseButtonDown (0)) {                     var ray = Camera.main.ScreenPointToRay (Input.mousePosition);                     RaycastHit rayHit;                      if (Physics.Raycast (ray, out rayHit)) {                             var rayHitPoint = rayHit.point;                              var rotationDirection = transform.position - rayHitPoint;                                                            rotationDirection.Normalize ();                             //rotationDirection.y = transform.position.y;                             rotationTarget = Quaternion.LookRotation (rotationDirection);                             rotationLerpProgress = Time.deltaTime;                     }                     //targetPosition = Camera.main.ScreenToWorldPoint (Input.mousePosition);                                     }              if (rotationTarget != transform.rotation) {                      transform.rotation = Quaternion.Lerp (transform.rotation, rotationTarget, rotationLerpProgress / rotationLerpDuration);                     rotationLerpProgress += Time.deltaTime;                       if (rotationLerpProgress &gt;= rotationLerpDuration) {                              transform.rotation = rotationTarget;                     }              }      }   I must be missing something. How do I do this right?