New answers tagged

1 vote
Accepted

Why do physic engines apply force fully linear, despite adding torque

Your belief that angular acceleration should somehow diminish linear acceleration is simply false. The linear and angular momentum of a system are each separately conserved. Imagine a unit cube, axis ...
user avatar
  • 112k
6 votes

Moving player inside of moving spaceship?

The ship stays in place and everything moves. Mostly. In this answer I present three ideas of how to go about it, and I'm referencing the games I'm basing them on. I could not find out what approach ...
user avatar
  • 18k
1 vote

Predicting Inclines and Declines for projectiles

Thanks to @DMGregory, they guided me in the right direction and I got it done. Briefly, what I did is this: Every time a new map is created, I also create a heightmap (a 2D array containing all ...
user avatar
  • 11
1 vote

Configurable Joint rotation doesn't seem to respect mass difference

Well, turns out the answer was pretty simple: Colliders Colliders are present by default on the Cube primitive, but I'd been deleting them because I don't need/want collision detection. Since I'm ...
user avatar
1 vote

The vector aiming to enemy is in wrong direction

Subtract position, not velocity. self.vel = self.world.enemy[0].pos - self.pos self.vel.normalise() self.vel = self.vel * self.speed
user avatar
  • 112k
1 vote
Accepted

How to connect rockets to a space capsule?

I would not give the rocket nozzles their own rigidbodies. I would instead attach them as children to the main rocket rigidbody so the whole thing becomes one single physics object. Then I would have ...
user avatar
  • 111k
0 votes

How to connect rockets to a space capsule?

If you connect the rockets to the capsule with a FixedJoint2D and call rbody.AddForce(new Vector2(rocketPower, 0)) in the ...
user avatar
  • 3
0 votes

How would I calculate the velocity of a sphere with an impulse applied at the top?

Think of this in terms of conservation of momentum / action and reaction. Let's work in an inertial frame that's co-moving with the ball, so that in this coordinate system, the ball is initially ...
user avatar
  • 112k
2 votes
Accepted

Unity CharacterController steps on colliders with 0 Step Offset

The official api of unity has a vague explanation of each parameter. After testing I got the relatively correct meaning of the parameters. In this collision situation, as long as the hemisphere of ...
user avatar
  • 641
1 vote
Accepted

How to manually Simulate Physics properly on Unity?

After a lot of research, I have a better understanding of this. the problem I describe is a very common problem due to unsync between frame rendering timestep and physics fixed timestep. Unity solves ...
user avatar
  • 123
0 votes

How to prevent a huge backlog of physics calculations from freezing browser when tabbing out of browser game?

Okay, I think I found the actual answer. This prevents all freezing from occurring (because it keeps your game running in the background even if you tab out). Here's how you do it: First, in your main ...
user avatar
0 votes

How to prevent a huge backlog of physics calculations from freezing browser when tabbing out of browser game?

Looks like I found a decent solution. So while requestAnimationFrame doesn't really seem to run at all when the tab is tabbed out (makes sense), ...
user avatar
2 votes
Accepted

How to prevent a huge backlog of physics calculations from freezing browser when tabbing out of browser game?

The way the Unity engine solves the problem of freezing the game while physics catches up is to enforce a maximum value the accumulator can ever hit. You can implement this by replacing ...
user avatar
  • 112k

Top 50 recent answers are included