Hot answers tagged

3 votes

Area2D only detecting body_exited once

The ball being an static body is odd... I suspect the Area2D is not detecting the static body at all, see the issue: Area2D does not detect moving StaticBody2D. I ...
Theraot's user avatar
  • 25.2k
3 votes

Bouncing balls miss collisions, bounce the wrong direction, of lose momentum on one axis when hitting a corner

It appears that your code is fighting with the physics engine about who gets to control the velocity vectors of the balls. When there is a collision between two rigidbodies, then the Unity physics ...
Philipp's user avatar
  • 118k
3 votes

Fast way to calculate angular intervals and occlusion of circular objects in a 2D vision cone

Here are some optimization suggestions: 1. Filter unnecessary tests Objects located outside the field of view circle(distance>r1+r2) do not need to be detected. ...
Mangata's user avatar
  • 2,451
3 votes

Rotating 2D sprite around tilted Y axis

I think this would be easiest using SKTransformNode.setQuaternion instead. This makes it easy to express a rotation by some angle around any axis you choose, rather than only rotations around the ...
DMGregory's user avatar
  • 132k
2 votes
Accepted

Rotating 2D sprite around tilted Y axis

Try creating the art so that the red line is horizontal, then rotate it in Swift on its zRotation, and animate scaling along the ...
John Nyquist's user avatar
2 votes
Accepted

How to make redirected player movement respond to same key?

Not tested, but you could try looking at which keys the player is pressing when they're warping and setting the velocity x/y values to 0 when they're released depending on how much the movement is ...
thirteen's user avatar
  • 188
2 votes

Why won't my bullets shoot?

It should have been .up instead of forward, because forward is for 3D. Then *-1 because I want it to go in the opposite direction.
John Hughes's user avatar
2 votes

Why is my enemy in unity 2d not moving?

Use formatted text instead of an image. In the OnEnable() and OnDisable() functions, you used ...
sammyiscuul's user avatar
1 vote
Accepted

Simulated light for a 2D tile-map with just SDL2?

I think what you want is to create a black texture with the same size as your screen, set it as the render target, render blurry white circles to it at the locations of the light sources, with the ...
HolyBlackCat's user avatar
  • 1,998
1 vote
Accepted

Optimal Approach for Transmitting and Rendering Large Pixel Art Game Maps in Unity

What I would suggest in this case is the following: Rendering details like pixel colour, are usually not crucial to game logic. Since you will need to render the 1000x1000 map as a texture, it is ...
Engineer's user avatar
  • 29.4k
1 vote
Accepted

Sprite chasing a target using move_towards_ip does not move

pygame.sprite.Group.draw: Draws the contained Sprites to the Surface argument. This uses the Sprite.image attribute for the source surface, and Sprite.rect for the position. So we need to update ...
Mangata's user avatar
  • 2,451
1 vote

Bouncing balls miss collisions, bounce the wrong direction, of lose momentum on one axis when hitting a corner

These issues can be solved by calculating the average normal, instead of the first collision normal. ...
ZozeR's user avatar
  • 42
1 vote

Fast way to calculate angular intervals and occlusion of circular objects in a 2D vision cone

My first move would be to use a Raycast at regular intervals between the start & end angles. In other words: begin at the starting angle perform a raycast ...
Pikalek's user avatar
  • 11.5k

Only top scored, non community-wiki answers of a minimum length are eligible