collision-detection

JavaScript wall collision on convex shapes, getting stuck at corner

99封情书 提交于 2020-05-09 07:54:27
问题 The bounty expires tomorrow . Answers to this question are eligible for a +50 reputation bounty. bluejayke wants to draw more attention to this question. this is a follow up to this other question: How do I handle player collision with corners of a wall In inspiration of the code given in its answer, I tried to write some new code. Basically, in the original, the wall sliding works very well on the inside of the walls, but I wanted to make it work on the outside as well, so I made a new basic

Pygame mask collision

旧街凉风 提交于 2020-05-09 06:34:13
问题 I'm trying to get proper collision detection with rotating surfaces in pygame. I decided to try using masks. It somewhat works, but it is not as precise as I'd liked/thought. I tried updating the mask at the end of the cycle to get a "fresh" hitbox for the next frame, but it didn't work as expected. What is my mistake? import pygame import random WHITE = [255, 255, 255] RED = [255, 0, 0] pygame.init() FPS = pygame.time.Clock() fps = 6 winW = 1000 winH = 500 BGCOLOR = WHITE win = pygame

didBeginContact delegate method not firing for ARKit collision detection

妖精的绣舞 提交于 2020-04-30 09:20:54
问题 I can't get the didBeginContact method to fire, I have been trying for a while and I can't spot the error, could use a fresh set of eyes: - (void)viewDidLoad { [super viewDidLoad]; self.lastRender = nil; self.accelX = 0.0; self.accelY = 0.0; self.accelZ = 0.0; self.isLooping = TRUE; self.tripWire = TRUE; self.lastPaddleNode = [[SCNNode alloc] init]; self.paddleNode = [[SCNNode alloc] init]; SCNPlane* paddlePlane = [SCNPlane planeWithWidth:0.067056 height:0.138176]; self.paddleNode.geometry =

Using a matrix as a sprite and testing if two sprites overlap

送分小仙女□ 提交于 2020-03-03 13:59:54
问题 Right now, I have a ball that moves around the screen in a random diagonal direction and bounces off the wall when it collides with it. An image of said program My end goal is to have the ball be a matrix and have it perform just the same around a 30x30 grid. I have tried the enumerate() function, but couldn't think of how to make it perform like it does in the picture and code I have referenced at the end of this post. by perform, I mean move randomly in a diagonal direction on the screen

Collision Detection using bounded boxes

时光毁灭记忆、已成空白 提交于 2020-02-03 08:16:47
问题 I'm doing a programing project for class. We are programing the game break out, which consist of a ball, a paddle, four edges, and bricks. the ball bounces off the different objects and each object preforms different operations upon itself when a collision is detected. below is my code which currently doesn't work. I'm trying to use the location of the object (its center point) to construct a bounded box and the values of each edge(Top, Bottom, Left, Right) to calculate if the boxes hit. I

Python Collision Detection with x and y coordinates for border

风流意气都作罢 提交于 2020-01-25 04:58:10
问题 Im working on a python turtle game where the turtle can move with commands but it has to be able to detect collision with rectangles and circles on the screen as well as the border. I have no idea how to do this can anyone help? 回答1: Collision is easy! Before the nitty gritty, you need to understand how to obtain the distance between two points. If you have not done this before it is just pythag! If you picture two points on a plane (red points on the picture), the shortest distance to travel

How to detect collision using PyBox2d and use that information

梦想的初衷 提交于 2020-01-25 00:20:49
问题 I am trying to filter collisions occurring in my Box2D world by reproducing this example: https://github.com/pybox2d/pybox2d/blob/master/examples/collision_filtering.py I have four classes in my world, Car, Wheel, Building, and Pedestrian, I want to filter which instance collided with which and one of the possible outputs is (pseudo-code) if contact.FixtureA.isinstance(Pedestrian) and contact.FixtureB.isinstance(Car): print("You have caused a traffic accident") I have this set of categories

VB.NET - Movement Blocked due to Faulty Collision Detection

£可爱£侵袭症+ 提交于 2020-01-24 16:27:06
问题 So, I am making a game for my programming class as part of my final project. I'm just in the planning and experimenting stage at the moment and I decided to get a headstart on graphics and collisions. I first made my program just by experimenting with the Graphics class VB has to offer, instead of using PictureBox es. Alongside that, I added keyboard input to move an Image around. When I decided to add collision detection through the intersectsWith() method of the Image class, things became

Detect overlapping of rectangular prisms

空扰寡人 提交于 2020-01-24 04:56:25
问题 Given a 3D coordinate system and rectangular prisms with a non-negative starting point and a non-negative size (e.g. starts at (0, 2, 5) and has a size of (9, 20, 5) ): how can I best check if another rectangular prism intersects with one of the prisms already in the coordinate system? Eventually, the goal would be to perform this check for all prisms present, being able to test one should be sufficient to complete this task. Info: starting points and sizes are 3-tuples of non-negative longs.

AS3 - Friction(?) causing Movie Clip to jump, temporarily alter path (playable SWF included)

心不动则不痛 提交于 2020-01-24 00:56:05
问题 Im making a game in FlashBuilder 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 and a 50 pixel border around. While testing Ive noticed that if I hold a direction key, then switch to another AND the MovieClip is travelling past a gap in the boxes, the movieclip will jump a few pixels in the previous pressed direction, then back down again quickly. It’s a split second flicker but creates