People who code: we want your input. Take the Survey

# Questions tagged [physics]

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

351 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
329 views

### How can I access an OpenGl buffer from within a GLSL 330 shader?

I am currently attempting to create a simulation using OpenGl's GPU acceleration for both the simulation computations and rendering. The rendering portion of my simulation is complete and working, but ...
235 views

### Object moving by adding force to Rigidbody bouncing off where ground objects met

I have a object that moving by adding force to rigidbody. With just big flat plane, it works fine but with connected small planes, sometimes(actually not sometimes, a lot) the object bouncing off or ...
99 views

### Collisions between two objects in 2D space

I am implementing the collisions of my game in javascript, and at the moment what happens when the objects collide is that they have their speed changed to 0. What I'm starting to want to do is to ...
76 views

### Setup golf ball physics

I am developing a simple Golf game as shown in the below image. I am facing below issues: Even if I apply small amount of force, the ball continuous move along the grass? Grass friction is not ...
44 views

### Struggling with the uncertainty of a position of a collision

I've been trying so hard to complete a working game of pong for the last couple of weeks but, simply put, the physics of trying to get the ball to bounce correctly of the paddle is preventing me from ...
42 views

### Torque Generation

I have written a basic physics engine. It is able to handle rotations. But how do I handle case like this where an object sits on top of another and needs to rotate due to the effect of gravity ? I ...
472 views

### 3D Coulomb Friction - Use Collision Impulse To Calculate Friction Force?

I've been using this document to learn how to implement a very basic physics engine. The section on Coulomb Friction on page 55-56 (marked as pages 43-44) confuses me. It observes that the friction ...
29 views

### Moving object with preset timelapse

I am a newbie game developer. I have one problem. Consider the following case. I have a simple game with only one object - a ball. A ball can move only up and down from one side to another. A User ...
25 views

### Browser sandbox for object interaction testing

I’m looking for a sandbox where I can upload/import STL or OBJ files (rigid bodies that I can export from a CAD software) for quick interaction testing with gravity and contact. The idea is lowest ...
86 views

### Set velocity at position?

In Unity3D there's a way to add force at a position and a way to get the velocity at a position. I'd like to be able to set the velocity of a rigidbody2d at a local position. My current solution ...
79 views

### Launching a projectile and landing it in a specific spot with different elevations?

I have a starting position for a projectile and a target position I want it to land on given an initial x and y velocity. Doing this on a level field is fairly straightforward but I'm struggling to ...
48 views

### Stretch line on bow using touch

I have drawn a line on sprite representing the string of a bow. I want to stretch it with finger touch input, using onTouch. I have added a Physics body but I don't ...
228 views

### How to apply friction on the car so that car slow down

I am working on a driving game. I am able to move the car using arrow key.I am accelerating the car by applying a force in what ever direction that car is.But I need to apply friction to the car so ...
89 views

### Have body resume constant velocity after collision

I want to have a body move at a constant velocity, but react to collisions. My example game is a train, I want it to move at 1 meter a second. If an obstacle appears on the tracks, I want it to react ...
432 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)...
119 views

### setVelocity allows body to pass through bodies

In my game, I'm using cocos2d-x and I wanted to have an object that changes direction immediately, so I used setVelocity() on the physics body to do that. However, ...
92 views

### How to avoid ai hands or any body part going inside wall or ground? (Unreal Engine4)

Whenever my character get killed near wall his hands or any body part its goes through the wall making it look like half of the hands front of wall and another half through back. but i dont like it.. ...
232 views

### Unity Mechanim makes physics behave weirdly

I'm developing a 2D Wrestling game in Unity 5 build 5.1.2f1. It's just the beginning so the character only has a number of animation states and a rigidbody2d. This is the state machine and these are ...
103 views

### Integer ops only 3D triangle-triangle collision detection

I've a need for 3D triangle-triangle collision detection using integer math only. Unfortunately, I'm not in a position where I can use 64-bit integers (only 32-bit) and my vertex values can be larger ...
83 views

### How velocity impacts on CCSprite in Cocos2d Chipmunk?

I am in need of the basic understanding of how velocity changing works? i.e. how CCSprite is able to jump at particular height when some velocity is set? Let me give you an example on which I am ...
745 views

### PhysiJS and objects on top of moving objects

Using Physijs which uses ammo.js. I am attempting to simply place a sphere on top of a box, the box is moving back and forth and I want the sphere to move with it while also being able to move on top ...
3k views

### 2D Physics friction on a moving platform?

I have a few basic platforming mechanics going on in this scene. I have a prefab platform with an animation that loops back and forth between two different x positions, but does not begin looping ...
96 views

### Which Box2D-like physics engine parameters need pixel conversion?

The official guide does not have any useful details on the matter: http://www.box2d.org/manual.html Position is an obvious one. What about velocity? Density? Anything else? Update: the context is ...
1k views

### How to slow down a Sphere smoothly in a world controlled by force and stop it (Unity 5)?

I am a beginner and I started to use Unity 5. I play with tutorials on the site and documentation. I was basically testing springs, physics materials etc. I have a problem understanding probably a ...
414 views

### (LibGDX/JAVA) How can I get a rectangle to rotate with this pendulum so I can start detecting collisions?

One of the objects in my game is a pendulum that swings in a semi-circle. This is done by having an update() method like this: ...
270 views

### How can I handle ball interaction with lanes in a pinball game?

In a pinball game, how can I handle collision or constraints on the ball for convincing movement on those highway rails/tracks? I assume using physics and a mesh collider would not work, even when ...
92 views

### Stuck on a steering problem

i'm building a car game, and currently working on the steering. i would like to change the motion of Z rotation so that the car rotates around the Z axis when the wheels are turned. I can't set the ...
38 views

### Applying angular velocity distorts model

I am calculating the orientation of a sphere through the following code ...
1k views

### Implementing a group formation behavior

I am trying to implement a group formation behavior where all the units in my group follow a leader and maintain their position throughout. So far I am able to move them, rotate and follow the leader. ...
275 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 ...
157 views

### Particle friction with variable timestep in XNA

Alright, so I'm working on an engine of sorts in XNA (yes, it's deprecated, I know) and I'm implementing my own particle system. I've defined a "ParticleEffect" such that when it's supplied a ...
102 views

### Lateral Friction Phisics

I am trying to create a physics engine for my game, and need to cancel out any lateral velocity for when entities turn. I have tried to mimic this page's example, but it is not working. I have objects ...
1k views

### Farseer: Difficulties with implementation of DebugView

I added the project "Farseer Physics Engine 3.3.1 HelloWorld XNA\DebugView XNA\DebugView XNA.csproj" to my solution explorer in Visual Studio. In addition, I added a reference to my project and the "...
25 views

### Make platformer character stay in the air at the top of a jump

I have a player who can jump. I want the character to stay in its position and not fall to the floor. This is the code I am using so far: ...
152 views

### Why is my character not reacting to the gravity I set?

I've got a little question about my gravity that isn't working and I can't find out why... The issue is that the player just go upper but doesn't really 'jump' and doesn't come back on the ground. ...
66 views

### Having a problem with referencing Farseer into my Monogame project

I am trying to load in the Farseer Physics Engine into my current Monogame project and whenever doing so, the Farseer solution will load in correctly but then when I try and reference it, it gives me ...
917 views

### How to resolve OBB collision penetration?

I would think this is a common issue, but I couldn't find an answer that helped me. Help would be appreciated. In my game I have rectangular objects. They have rotating bounding box, aka not AABB but ...
29 views

Im sure there is some sort of technique with a name I don't know or didn't think to search, but how would I go about making an effect similar to loose dirt sliding down the face of a slope when ...
573 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 ...
267 views

### How to make a sphere bounce while it is moving forwards Unity

I am trying to make a sphere that I have moving forwards also bounce at the same time. Here is what I have tried. Adding a physic material to the sphere and setting the material with a friction ...
124 views

### How can I prevent the balls from overlapping?

I am making a ball rolling game controlled by tilting an accelerometer. In my game multiple balls overlap, so they end up showing as only one ball. How can I solve this problem, so balls do not ...
195 views

### Why does this implementation of aabb-sphere collision ghost collide and how can I fix it

I am trying to make a collision detection system and the aabb-sphere collision isn't working. Here is my code. This method checks to see which whether I should collide with AABB-AABB, Sphere-Sphere, ...
104 views

### Obtain jump vector given time, distance and gravity

I tried for several days to solve my problem , but in the end I just gave up and I decided to ask , since the solution is beyond my knowledge I'm writing a 2d top-down game, in order to simulate the ...
113 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 ...
110 views

### wheeled 2D character controller platform edges problem

I have built a little wheeled 2D character controller (a rectangle for the body and a circle for the legs with a motor joint). Everything is ok but the problem is that when the player reaches the edge ...
820 views

### 2D bouncing formula doesn't work properly

I am new to Unity, and I am trying to create a bouncing ball, so I've been researching bouncing related physics and I found a formula: Formula: ...
2k 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 ...
2k views

### How to design basic physics and movement behavior for 2D platformer?

I want to make a simple 2D platformer. I know some basic 2D physics and how to implement them in a game. How to make a character jump, accelerate, decelerate, etc. But I have no idea how to actually ...