collision-detection

Brick Collision Java [closed]

时间秒杀一切 提交于 2019-12-10 20:55:26
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I have been working on a Breakout game and have just about everything done except for the brick collision. The ball bounces of the wall and paddle fine, but when it comes to the brick it goes straight through them. I'm pretty sure the problem is in the checkBrick() part of the

Perfect circle to perfect circle and Perfect circle to straight line collision HANDLING in Java

帅比萌擦擦* 提交于 2019-12-10 19:54:18
问题 I am a newbie at Java, but decided to make a application that has a bunch of balls bouncing around. Please keep in mind that I know almost nothing about normals, which I have seen mentioned a lot in this kind of thread. I have also only take Algebra 1, and know a little bit of trig (sin, cosin and tangent). Anyways... I have collision detection covered, using if (java.awt.geom.Point2D.distance(X1, Y1, X2, Y2) < ball1.radius + ball2.radius) {return true;} else {return false;} and if (ball.x +

How to kill turtles when they touch?

偶尔善良 提交于 2019-12-10 18:39:46
问题 I can't seem to get turtles to die when they touch each other. I can only kill them when they are on the same patch. Is there any function like this? to killturtles if contact? [die] end 回答1: There is not but assuming your turtles are round or roundish ask other turtles in-radius (size / 2) [die] is a good approximation. 回答2: If "touch" means that the turtle icons are overlapping, you might need something like the method that King-Ink suggests (but there could be a complication like the one

Java collision detection for rotated rectangles?

≯℡__Kan透↙ 提交于 2019-12-10 14:12:59
问题 I am writing my first java game and so far: I've made a rectangle that can walk around with WSAD, and he always faces where the mouse is pointing. Also if you click, he shoots bullets where your mouse is pointing (and the bullets rotate to face that direction). I've also made enemies which follow you around, and they rotate to face towards your character. The problem i am having is that the collision detection I've written is only detecting the collision of the objects (character, enemies and

Unity2D - Ignore collision with edge collider

做~自己de王妃 提交于 2019-12-10 12:13:33
问题 I am trying to have my player ignore the collision with an edge collider on a platform i have. Here's the script that I have added to the player public class TestMovement : MonoBehaviour { public Rigidbody2D ball; private GameObject purplePlat1; private GameObject player; // Start is called before the first frame update void Start() { purplePlat1 = GameObject.Find("purple_plat"); player = GameObject.Find("circle-png-44659"); ball = GetComponent<Rigidbody2D>(); ball.AddForce(new Vector2(0, 10)

AS3 - Movie Clip animations (undesirably) bob up and down. [Playable SWF included]

和自甴很熟 提交于 2019-12-10 11:55:18
问题 Im making a game where the player controls a movieclip (_character) around the stage with the arrows or WASD. On the stage there are squares/boxes with collision detection. Plus a 50 pixel stage boundary. _character has five key frames, each with an animation inside, which plays when the four direction buttons are pressed, plus the red stationary animation when no keys are pressed. While moving the characters body and head should be still, with the legs moving. Example below _character Right

Sceneform Collisions With Camera

淺唱寂寞╮ 提交于 2019-12-10 10:42:23
问题 I'm stretching my very limited ARCore knowledge. My question is similar (but different) to this question I want to work out if my device camera node intersects/overlaps with my other nodes, but I've not been having any luck so far I'm trying something like this (the camera is another node): scene.setOnUpdateListener(frameTime -> { Node x = scene.overlapTest(scene.getCamera()); if (x != null) { Log.i(TAG, "setUpArComponents: CAMERA HIT DETECTED at: " + x.getName()); logNodeStatus(x); } });

Collision detection tutorials [closed]

馋奶兔 提交于 2019-12-10 10:35:10
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I'm supposed to develop a Java game using AWT. I'm stuck with the concept of "collision detection". If you can help me with any tutorials that explain the concept (how it works) or give examples (source code), I'd be grateful. 回答1: A strong tutorial on 2d collision detection can be found at metanetsoftware

Java Circle-Circle Collision Detection

两盒软妹~` 提交于 2019-12-10 10:13:53
问题 Here is the circle class: public class Circle { private double radius; private double x; private double y; } How can I tell if two objects from this class (circles) are colliding? P.S. Can you use the method that avoids taking a square root? 回答1: double xDif = x1 - x2; double yDif = y1 - y2; double distanceSquared = xDif * xDif + yDif * yDif; boolean collision = distanceSquared < (radius1 + radius2) * (radius1 + radius2); 回答2: dx = x2 - x1; dy = y2 - y1; radiusSum = radius1 + radius2; return

Counting lattice points inside a triangle

我怕爱的太早我们不能终老 提交于 2019-12-10 08:55:08
问题 I've points for a big triangle lets call it a, b, c. (a = (x, y) and so on). Now I want to count the number of integral points inside the area enclosed by this triangle, so I first looked at Pick's theorem. The second approach that I considered was generating a list of points bounded by max, min of the triangle, and then checking if each point lies inside the triangle. I used the Barycentric coordinates method to do this. It works however my triangle is pretty huge and my program is basically