collision

Why are my balls disappearing? [closed]

强颜欢笑 提交于 2019-12-03 02:11:01
问题 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 5 years ago . Pardon the funny title. I've created a little graphic demo of 200 balls bouncing and colliding, both against the walls and each other. You can see what I have currently here: http://www.exeneva.com/html5/multipleBallsBouncingAndColliding/ The problem is that whenever they collide with each other, they disappear.

WPF C# Finding the corners of a transformed RectangleGeometry

怎甘沉沦 提交于 2019-12-02 21:35:15
问题 I'm trying to do some hit testing on a Rect I've drawn with several RenderTransforms pushed to the Canvas' DrawingContext. I've applied the same rotate/scale/translate transforms to a RectangleGeometry so I can get the bounds of the final drawing. However, the .Bounds property on RectangleGeometry returns the axis-aligned bounding box, while I need the oriented bounding box. In short, I need some way to find the corners of the actual transformed rectangle so I can perform hit/collision

how to detect when a ImageView is in collision with another ImageView?

夙愿已清 提交于 2019-12-02 20:43:57
问题 Im developing a test game with some imageviews on the screen. with the finger, i am moving another imageview. I want to detect when the imageview moved by the finger has touched another imageview. ¿Wich is the best way to achieve it? I can't find info about it on google... Thanks 回答1: I'll answer the general question - find out when two views overlap : private boolean viewsOverlap(View v1, View v2) { int[] v1_coords = new int[2]; v1.getLocationOnScreen(v1_coords); int v1_w = v1.getWidth();

Object gets stuck when trying to bounce off screen edges, am I doing this wrong?

这一生的挚爱 提交于 2019-12-02 17:40:37
问题 public class AsteroidMovement : MonoBehaviour { public Vector2 speed; public Vector2 direction; private Vector2 movement; private Vector3 TopScreenBound; private Vector3 BottomScreenBound; // Use this for initialization void Start() { TopScreenBound = Camera.main.ViewportToWorldPoint(new Vector3(0f, 1f, 0f)); BottomScreenBound = Camera.main.ViewportToWorldPoint(new Vector3(0f, 0f, 0f)); } // Update is called once per frame void Update() { if (gameObject.transform.position.y >= TopScreenBound

Why are my balls disappearing? [closed]

时光怂恿深爱的人放手 提交于 2019-12-02 14:12:59
Pardon the funny title. I've created a little graphic demo of 200 balls bouncing and colliding, both against the walls and each other. You can see what I have currently here: http://www.exeneva.com/html5/multipleBallsBouncingAndColliding/ The problem is that whenever they collide with each other, they disappear. I'm not sure why. Can someone take a look and help me out? UPDATE: Apparently the balls array has balls with coordinates of NaN. Below is the code where I push balls to the array. I'm not entirely sure how the coordinates are getting NaN. // Variables var numBalls = 200; // number of

How do I detect pygame collisions?

天大地大妈咪最大 提交于 2019-12-02 13:07:06
I'm currently developing a small game with pygame and I'm having a hard time figuring out a way to check for collisions. I've found this question , but I can't use the pygame.sprite.spritecollide(player, wall_group, True) because my called player isn't a 'sprite', it's a class that I've created (that uses the functionality of normal shapes ( https://www.pygame.org/docs/ref/draw.html )). If anyone could figure a way that I can detect collisions and explain to me shortly about the difference between 'sprite' and just a normal shape like circle/rectangle I would appreciate it. To use pygame's

cocos2d v3 collision detection

纵然是瞬间 提交于 2019-12-02 10:43:11
问题 I'm trying to inspect collision collision of two bodies, but collision detection callbacks are not being fired. Here is my code: 1) My CCScene implements CCPhysicsCollisionDelegate protocol 2) I set collision delegate for physics _physics = [CCPhysicsNode node]; _physics.gravity = PHYSICS_GRAVITY; _physics.debugDraw = YES; _physics.collisionDelegate = self; [self addChild:_physics]; 3) For each of two body I set a collision type body1.collisionType = @"body1"; body2.collisionType = @"body2";

Collision Detection In Unity3D

旧街凉风 提交于 2019-12-02 09:46:05
I am working on 3D fighting game.I have two character with their animation.I have applied character controller and character controller script which i have customized. I have two button one to move farword and one to move backword..And four button to play different animation just like make a punch, hit a leg etc. Upto that its work perfactly fine. Now I have use capsule object with their capsule collider as a child of different bones. Like i have place one capsule object with their collider the child of left hand bone.SO where the bone move that object will move.. I have also place a capusle

how to detect when a ImageView is in collision with another ImageView?

爷,独闯天下 提交于 2019-12-02 09:23:49
Im developing a test game with some imageviews on the screen. with the finger, i am moving another imageview. I want to detect when the imageview moved by the finger has touched another imageview. ¿Wich is the best way to achieve it? I can't find info about it on google... Thanks I'll answer the general question - find out when two views overlap : private boolean viewsOverlap(View v1, View v2) { int[] v1_coords = new int[2]; v1.getLocationOnScreen(v1_coords); int v1_w = v1.getWidth(); int v1_h = v1.getHeight(); Rect v1_rect = new Rect(v1_coords[0], v1_coords[1], v1_coords[0] + v1_w, v1_coords

C# panel move with collision

…衆ロ難τιáo~ 提交于 2019-12-02 07:20:25
I am new to C# and Winforms and try to make a moving panel. It should move right until the end of my window and then back left. It should bounce from side to side. But the only thing happened after hours of trying is that it moves left and stops. Using this form tools: Timer = tmrMoveBox (interval: 50) Panel = pnlBox Label = lblXY (for showing the X and Y coordinates in the form) Here are my first best try: private void tmrMoveBox(object sender, EventArgs e) { if (pnlBox.Location.X <= 316) { for (int i = 0; i <= 316; i++) { pnlBox.Location = new Point( pnlBox.Location.X + 2, pnlBox.Location.Y)