# Tagged Questions

Relating to the motion of objects through space and time. Including concepts such as acceleration (thrust and gravity), mass, collision response, friction and more.

88 views

### Speeding up sprite the second time it passes the screen [closed]

I'm a student studying Games Development. I want a sprite to speed up on it's second passing of the screen. How do I do this? Code I wrote so far: public class Game1 : Microsoft.Xna.Framework.Game { ...
315 views

### Wandering motion in Unity

I am trying to come up with a smooth wandering motion for my game-object using Unity. What I currently doing is rotate the object by some random angle calculated every 1.5 second delay. But I am ...
193 views

### How can I simulate a magnet that attracts a ball in a 2D enviroment?

I am making a top-down game where you have to move a ball from point A to point B. You are attracting the ball using magnets that are standing still. The ball needs to get pulled by multiple magnets. ...
132 views

### Calculate an approximate distance between two rigid bodies or OOB

Is there any easy way to get an approximate distance between two OOB? I searched around and people talk about GJK algorithm, however I don't see it returning the distance between two convex objects ...
66 views

### How to apply physics when you have sub frame state changes?

I'm currently calculating my physics every 1/100th of a second and using a state machine to manage the current state of the player. In my main loop I'm checking user input and transitioning the state ...
3k views

### Unity Physics Material - Character Slides Too Much

I am currently working on a 2D platformer in Unity. I am using a prefab from the AssetStore for my character (The last paragraph contains a link to the prefab). The character has a circle collider for ...
3k views

### Unity 2D, C# - Make object move diagonally by a certain angle?

I have a sprite object which I want to move in 8 directions. Left, Right, Up, Down, Left top, Right top, Left down, Right down. The view is 2D with a isometric projection. The difficulties I am ...
397 views

### Incosistent jump, stuttering

I've written this C# code to handle movement in my testing project. The game is supposed to be 2D, some kind of a platformer, just to get me started with Unity. However, it seems there's something odd ...
269 views

### Implementing a motorized hinge joint

I have a 2d physics engine, with three boxes: "body", "left wing" and "right wing". The wing boxes are connected to the body using a hinge joint. The physics world has no gravity. I'm attempting to ...
127 views

### Drawing a object with Box2D and HTML5 canvas on current mouse position

I'm attempting to create a air hockey type game with HTML5 canvas and JavaScript, using Box2dWeb for the physics calculation. I need a way to draw the puck at the current mouse x and y position every ...
249 views

### Unrealistic sphere behavior on inclined plane

I am trying to model a ball rolling down an inclined surface in Unity based on what I am observing in real life but it is still quite off. In Unity it takes the ball about 3 seconds to travel from a ...
226 views

### AABB implementation

I have seen in some texts and tutorials on the web where an AABB is implemented as a position vector and then half-width and half-height vectors. What is the advantage in using the half-width and ...
2k views

### Ease Rotate RigidBody2D toward arbitrary angle

I'm trying to make a rigidbody2D circle return to an orientation after a collision. But there is a weird behavior I do not expect - it always orients to the same direction. This is what I call in ...
32k views

### Simple collision detection in Unity 2D

I realise other posts exist with this topic yet none have gone into enough detail for me. I am attempting to create a 2D game in Unity using C# as my scripting language. Basically I have two objects, ...
156 views

### Calculate velocity of a bullet ricocheting on a circle

I made a picture to demostrate what I need,basecaly I have a bullet with velocity and I want it to bounce with the correct angle after it hits a circle Solved(look the accepted answer for explain): ...
2k views

### Unity - Mecanim & Rigidbody on Third Person Controller - Gravity bug?

I'm working on a third person controller which uses physX to interact with the other objects (using the Rigidbody component) and Mecanim to animate the character. All the animations used are baked to ...
1k views

### How can glass breaking effect from Smash Hit be achieved? [duplicate]

I saw Smash Hit the other day and was amazed by the physics of the game, specially the shattered glass effect: I've read other posts about this subject but I still feel that they don't share enough ...
208 views

### Is Physics a prerequisite to learn Unity3D

I have got a basic knowledge about the Unity 3D platform but I coding in Unity has not been that easy for me. For the simple reason I can see is, I cannot understand which function to use for what ...
570 views

### Consistent Space Gravity Simulation

I have done some reading into this subject but haven't been able to come to a conclusion that I'm really satisfied with so far, so here is the situation. I have a game set in space, its top down and ...
307 views

### Bullet - objects falling through

I have problem with bullet collisions. You can see problem on this video (around 0:18): http://goo.gl/DiVP8l Objects are "embeded" inside vertical bars - that is not correct - they should be ...
1k views

### What torque should I apply in Bullet to maintain a vertical orientation?

I have a RigidBody in Bullet. Each frame, I want to apply torque to correct its orientation toward an upright position (i.e. near-zero pitch and roll). I know its angular velocity and orientation. ...
193 views

### Determining a sensible gear-like hierarchy for a series of connected objects

I would like a series of objects to behave in similar manner to a series of connected gears. This means that each black object in the diagram below will rotate at a speed based on the ratio of their ...
175 views

### Irregular oval collision detection

I am using a physics library based on the Bullet physics engine. How do I create an egg shaped object or a cylinder where the width differs from the depth (i.e. with an oval shape)? I'm not looking ...
882 views

I'm would like to achieve something like Object A will jump to position A in parabolic way. For example: I am able to make the object jump but i do not know how to calculate to make the object jump ...
657 views

### What is the appropriate way to implement wobble/balance mechanics in Unity 3D?

We are trying to implement a minigame where the player character sits on a bouncing ball, and needs to a) hit forward to move forward and b) hit left/right to adjust against the the ball's natural ...
283 views

### How to run physics simulation in the background for possible future outcomes?

I'm designing a physics-heavy game in 3d. The core mechanic of this game is that the user gets to choose his actions based on probable future outcomes. For example - the player has a choice whether ...
1k views

### Unity WheelJoint2D will not rotate when increasing motor speed

I have a wheel joint 2D attached to a game object in Unity: In its associated wheel script I am increasing the motor speed as described in the tutorial. public class Wheel : MonoBehaviour { ...
336 views

I am stuck on the code for couple of days but couldn't figure it out. Therefore I turned out to look the answer here but couldn't find any that match the requirement Hope some One might help here is ...
770 views

### How can I implement a more realistic momentum system in Unity 4.5?

I'm just starting out with Unity and am making a simple environment where there is a sphere and a ramp. When the sphere approaches the ramp everything is fine. As soon as the sphere hits the ramp is ...
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 ...
1k views

### How do you properly implement level boundaries in a physics room?

I have an issue with creating a proper boundary in GameMaker Studio when using a physics enabled room. My room has a gravity of 0, as it is in Space. My player object has the default values, but a ...
150 views

### Character animation in physics-simulated environment

What are the standard solutions for animating characters in physics-simulated environments? Let me explain what I mean - in most games characters are pretty much excluded from physics simulation - ...
1k views

### Character bounces/stutters down hills

I'm using Unity3D (not 4) and I'm experiencing a bit of a problem with character movement. I'm using a cylinder as a First Person player with a child Main Camera. In this cylinder is the stock ...
43 views

### Moving multiple hingejoints based on joystick input

I'm controlling a 2D side-viewed (facing right) stickman with a joystick. The movements are fairly intuitive: Joystick down -> Stickman crouches down Joystick up -> Stickman stretches out ...
709 views

### Swinging a sword in Xcode with Sprite Kit

I'm working on making an RPG in Xcode, and I'm having a major gameplay issue when it comes to having my character swing his sword in a way that is realistic and gameplay compatible. Right now, when ...
1k views

### How to detect collision on specific part of the sprite node

I have a spike and a ball is falling down, when the ball touches the top point of the spike, I want to make the ball invisible, and when it touches on the other part i.e on the sides I don't want to ...
205 views

### Best practice for organizing the physics of objects?

Apologies because this is a long post and I am inexperienced. I would really appreciate the input from some experienced developers. These are my two goals for this project: To learn the best ...
889 views

### Trajectory Projectile with Collision Detection

Right now I am trying to create projectile for cannon in which I want to detect collision also. At present I have simple working projectile after using two references Unity – How to display ...
805 views

### How do I resolve a sphere-triangle collision in a given direction?

I am trying my hand at game physics. I understand that the basic way to pull back a sphere when it collided is to negate the penetration distance: // If collided... // `distance`: distance form ...
145 views

### PhysX - Revolute joint around unit vector

I'm using a right-handed coordinate system with (0,0,-1) = forward, (1,0,0) = right and (0,1,0) = up. PhysX version is 3.3.0. I have a unit vector which represents the axis around which my actor is ...
576 views

### Frame-rate independent friction on movement in 2d game

I have been trying to implement a simple physics system for a 2D space game I am making. I have it pretty much working, but I have encountered an issue with the way I apply friction. I have tried ...
409 views

### Why are my Box2D wheels slipping on ground?

I have a car, set up in Box2D as a rectangle connected with two wheels using WheelJoints: The wheels are defined as follows: FixtureDef wheelFixtureDef = new FixtureDef(); wheelFixtureDef....
76 views

### CCTextField won't appear

I can't seem to add a CCTextField in my physics node, I tried all different methods, but it's still not happening. Here's my code: CCTextField *tf = [[CCTextField alloc] init]; tf.contentSize = ...
624 views

### How to add a constant horizontal force just like gravity?

I want to add a constant horizontal force, just like gravity to a projectile or a sphere moving in 3d space, which will make the projectile or ball or sphere or whatever be influenced by this force so ...
414 views

### Unity's default integration method

Which method(s) does Unity provide for physical integration? RK4? Verlet? Euler?
799 views

### What is the easiest way to make an object follow the edge of a sprite?

I have a rounded rectangle sprite and another sprite that's just a circle. I want the center of the circle to follow the edge of the rounded rectangle. Is there any easy way to accomplish this task? I'...
358 views

### How can I predict player-to-projectile collisions in Box2D?

I'm making a real time shooting game with Box2D as the physics engine. The gameplay is mostly about trajectory, like Angry Birds. I want to make a slow motion effect and move camera to the player when ...
396 views

### Self colliding cloth physics

I've previously simulated cloth using Verlet integration but couldn't successfully get the cloth to collide with itself in an efficient way. The reason being is because I used a brute force algorithm ...