I am trying to make a game with the  and would like to implement some sort of planetary gravity. Essentially I just want the player to be able to walk on a circle or orbit a point. I was wondering what would be the best way to do this in phaser. I know that you can set objects gravities but you can only do so in the x and y direction.
41632
I'm trying to make a simple game where a spaceship is launched and then its path is effected by the gravity of planets.  Similar to this game:   I wish to know how to replicate the effect the planets have on the spaceship in this game so a spaceship can 'loop' around a planet to change direction.  I have managed to achieve some bogus results where the spaceship loops in a huge ellipse around the planet or is only slightly affected by the gravity of a planet using Vectors.  Thanks in advance.  p.s I have plenty of coding experience just none to do with game dev.
68118
I built a flat circular plane in minecraft, and am trying to force players to remain within this area. The circle is 161x161 centered around 0, 44, 0. I then placed a command block at the very center, with the command tp @a[rm=80,r=85] 0 45 0. This teleports everyone more than 80 and less than 85 blocks from the command block back to the center of the circle, creating basically a hemisphere (the sphere is cut in half by the circular plane) to move within.  However, I want to instead restrict movement to a cylinder from y=44 to y=infinity. With this method you would only be teleported when your x and z coordinates exceeded the boundary of the 161x161 circle, ignoring your y coordinate. You would be able to stand at the edge of the circle and fly up as high as you wanted without being teleported. This does need to keep the same property of the previous command to not teleport players outside 85 blocks. It will only teleport those who have an x and z change of between 80 and 85 blocks ( 85&gt;sqrt(x²+y²)&gt;80 )  I tried variations of the command involving the dy argument, but this only removed the teleport all together.  Note: If it is not possible to have an infinite height limit, restricting to any value above y=70 would also work. In addition, the ideal minimum of y=44 can be changed, but not increased.
102215
I have some bullets that simply have an always sensor and motion, but since I have gravity on, they fall in a weird way. They do not fall and hit the ground on the tip of the bullet, but rather hit the ground in the exact position they had when they were fired, sleeping. How do I have the bullet tilt as it falls, and possibly have it hit the ground on it's tip?
10095
I know how to make it manually with cone rotation around the sphere. but maybe there's much simpler solution or addon that has that option, preferably not very high poly solution.  Also if possible I would like the spikes not to be very pointy if that makes any sense      Thanks
96248
I know this sounds silly but I would like some objects to follow physics while others not to collide each other.   I tried to achieve them by setting their position exclusively. But then it will ignore all physics.   Is what I am trying to do even possible?
116816
I have an A* implementation that works in "top down" situations where gravity is not taken into account for pathfinding. But, I am looking to modify to work in a 2d platformer situation. I am using the Unity Engine in C# but any examples or even pseudocode would be really helpful. I have found a source so far but it haven't been that helpful as I am not understanding the way they have adapted A*, I have listed them below.    (Very specific to authors implementation and hard to understand)
96852
so I had my first approximation to the gravity equation  \begin{equation} F=GmM/r^2 \end{equation} and some questions arose that my teacher couldnt respond: if r approximates to 0 with mM being constant, then the force should tend to infinity, right? so that being true, then if we would travel to the center of the earth, we would be crushed by gravity? if so, how can there be anything right in the center of the earth? wouldnt anything there be compressed and destroyed by the infinite force?  having that in mind, my next question is as gravity force is measured from the center of an object, any part of the same object which is not at the center would be affected by the same object's gravity? if so, how can we differentiate between two objects that are not in a vacuum? my question originated thinking in us standing on the earth, in contact with it, are we, in a gravitational sense, one object? this lead to the last question, if gravity is a property of matter, then how applying the same logic as before, how does it work between two neutrons?(chose neutrons because i assumed it would be more difficult obtaining gravitational force if there was electrostatic forces from charges inbetween) do two newtrons in contact count as 1 gravitational object? and how thats its own gravity affect the newtron from center and out?
52439
I have two objects (target and player), both have Position (Vector3) and Rotation (Quaternion).  I want the target to rotate and be facing right at the player.  The target, when it shoots something should shoot right at the player.    I've seen plenty of examples of slerping to the player, but I don't want incremental rotation, well, I suppose that would be ok as long as I can make the slerp be 100%, and as long as it actually worked.  FYI - Im able to use the position and rotation to do plenty of other things and it all works great except this last piece I cant figure out.  Code samples run in the Target's class, Position = the targets position, Avatar = the player.  EDIT  Im now using Maik's c# code he has provided and it works great!
113472
I have a blender file where a sphere is orbiting a force field. I want it to be more red when it's closer to the center, and more blue when it's further. I already have the math figured out, I just need to know how to get x/y coordinates in nodes.  Here's the file:
50653
It has come to the point in my computing program now where I have 5 swinging pendulums that are all modified at once by slider values. These values are drawn onto the from and passed through the class pendulum. To change the values the update button is run, and their is a default option to use a setup that works. The values are also shown on screen through some simple labels. The zero button sets all values (except length) to zero.  The values for each pendulum drawn is:   String length angle Acceleration (angular) Angluar velocity Damping or friction Gravity   My calcuations for these values: (Bob = the weight at the end of the string, and there are X and Y Co-ordiantes for it.  bobX = originX + (Math.Sin(angle) * length);         bobY = originY +(Math.Cos(angle) * length);   Caclulate Acceleration:  Angular Acceleration = (-1 * gravity / length) * Math.Sin(angle);    Increment Velocity:          Angular Velocity += Angluar Acceleration;   Increment Angle          angle += AngularVelocity;   Friction action, pendulum eventually 0's          AngularVelocity*= damping;   Now my next task is to make the pendulums collide "realistically" and recreate a newtons cradle type effect. I've looked into elastic collision solutions on particle e.g. here is an excellent example:    I've also looked at the raw physics behind it  but my brain couldn't get to grips with the raw physics side of things.  So I'm wondering if anybody could help me figuring out the theory for the collisions.  My current idea is when the co-ordinates meet the velocity will simply change polarity e.g. +10 to -10 in the opposing pendulum. Am I correct here?  If you are into code I've posted the code on stack overflow
4260
I'm writing a python script that creates a large number of objects and I'd like them all to point at a certain point in 3d space.  (left is what I've got, right is what I want)   Pretty much exactly like the 'Track-to' constraint, but I don't need it to update interactively or be animated, I just need to rotate each object when they are created. I also don't care about the up-direction at all, since the objects are cylindrically symmetrical.  I know how to create the objects, but I don't know how to aim them. I'm not good at maths, so I don't even know where to begin with this other than that it'll probably involve vectors and matrices (which I don't really understand).  The reason I don't want to use the existing constraint system is because it's a bit slow when dealing with a lot of objects, and I'd like to learn a bit about this sort of maths.
94881
Certain things in the game occur when you have taken x steps. Happiness, egg production/hatching, etc are all determined by the number of steps you have taken.  In previous Pokemon games, it is immediately obvious when you take a step. You press up, your character moves one step. There are only four directions to move in, and each step is locked to a grid.  In X/Y, however, movement is more fluid. I can take what seems to be a "partial step" by bumping the analog stick quickly, or move at an angle that wasn't possible before. In addition, there's no built-in step counter (like the Poketch app for DPPT), so it seems I have no way of knowing at all what a step is.  Is there a specific distance that counts as one step? If so, what is it? When moving at an angle, is the distance Euclidean (e.g. ~√2 steps if I'm moving at 45 degrees for one unit in both x/y directions)?
6028
Is it possible to use the Lagrangian formalism involving physical terms to answer the question of why all planets are approximately spherical?  Let's assume that a planet is 'born' when lots of particles of uniform density are piled together, and constrained only by the Newtonian gravity of the $N$ particles with no external gravity.    My question is: Is it possible to use the variational calculus starting from this situation to prove that planets should be spherical?
39822
My group of students is helping produce a a 2D platformer. We tried making a pixel-based collision system which fell through. Now I am trying this physics engine on for size and see new ways to create and control my player. Like the obvious circle body player:    I was using a different type of player movement system like .  What system would work for a player that needs to be able to jump and move in mid-air (as in the above link), and can run up slopes like the circular body example?  I guess that the circular body can be made to do anything, but would like community input.
45032
If I push or hit an object in space (vacuum and no gravitation) in direction what is not going trough its centroid, will it rotate or move along in straight line?   I expect that on earth it will depend on what is less difficult for the object (rotation or linear movement). So the object will do some kind of combination of both movements (rotating and also moving along the direction of impulse or force).  But how could an object "decide" what to do in space, where is not resistance?
71328
I would like to show that a particle orbiting another will follow the trajectory   \begin{equation} r = \frac{a(1-e^2)}{1 + e \cos(\theta)}. \end{equation}  I would like to do this with minimal assumptions. Any pointers? I've read that this is nothing but the equation for an ellipse, as defined from the focus of the ellipse. But I'm not satisfied in just taking the result, I mean why should I assume that orbits are elliptical? I guess it should be derivable from energy and angular momentum considerations...
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.