New answers tagged

2

Raycasts and steering You'll find the path as you go, casting rays and checking for different cases. Pink - Your entity Red - Offset ray. Cast perpendicular to the forward of your entity. Maintains a specific distance from the wall and used to ensure the wall is still there. Blue - Look ahead ray. Looks ahead for the wall and is responsible for the ...


3

Use the normals of your surfaces to calculate this. Essentially, you're taking your existing edge, and growing it. Then, in some cases, optimizing it to cut out loops or tight corners. For each corner, you get the averaged normal for the two surfaces that make up that corner. For interior corners, since the average would be pointing towards each other, you'...


1

You can make an invisible copy of your ball which you update for as long as it didn't reach the paddle. Here's an example: Suppose you have a ball class which looks something like this: function Ball(x, y, size) { this.x = x; this.y = y; this.size = size; this.vx = 0; this.vy = 0; } Ball.prototype.update = function () { // Move the ...


1

Simple solution: Have the paddle always move towards the current horizontal position of the ball. When the x-coordinate of the ball is larger than the x-coordinate of the center of the paddle, move it right, otherwise move it left. Better solution: Extrapolate where the ball will reach the finish-line and have the paddle move towards that point. In both ...


1

Another strategical rule of Tetris you didn't mention is that it is crucial to avoid closing up holes. || Bad move! \/ ## ## ### ##### # ### ###### # ### ####### # <-Creates a closed up hole on this row. ########### # Place it somewhere on top instead! When there is no way around it, it's better to create the hole in a row ...


0

I ended up doing what DMGregory suggested and it works well. Here's some relevant code (though not standalone) that can be used for computing the two styles of tangents. I'm sure this code isn't efficient, and it's probably not even correct in all situations, but it's working for me so far: bool Circle::outer_tangent_to(const Circle & c2, ...


0

It seems to me that your character collider is partially embedded in the ground plane at y=0.57, and the rounded bottom of the capsule collider pushes it up to y = 1.6355, which is the height at which your collider rests on the ground. This seems almost certain given that the main character collider ends up at the same height after falling from above. At y =...


0

Found an answer here. I thought a behaviour tree should start at the last running node to start computation time but that lead to the problem stated in the article. Treating Running States One common question when implementing a Behavior Tree is that: what to do in the next tick after a node returned a running state? There are two answer to it: ...



Top 50 recent answers are included