collision-detection

WPF Paths Collision detection?

流过昼夜 提交于 2021-02-07 04:11:00
问题 I have two hexagon shapes <Path Stroke="Black" HorizontalAlignment="Left" VerticalAlignment="Top" Fill="Red" StrokeThickness="1" Name="Hex1" Canvas.Left="31.343" Canvas.Top="26.866" Height="163.687" Stretch="Fill" Width="159.134" > <Path.Data> <PathGeometry > <PathGeometry.Figures> <PathFigureCollection > <PathFigure StartPoint="43,0"> <PathFigure.Segments> <PathSegmentCollection > <PolyLineSegment Points="43,0"/> <PolyLineSegment Points="86,25"/> <PolyLineSegment Points="86,75"/>

WPF Paths Collision detection?

吃可爱长大的小学妹 提交于 2021-02-07 04:09:36
问题 I have two hexagon shapes <Path Stroke="Black" HorizontalAlignment="Left" VerticalAlignment="Top" Fill="Red" StrokeThickness="1" Name="Hex1" Canvas.Left="31.343" Canvas.Top="26.866" Height="163.687" Stretch="Fill" Width="159.134" > <Path.Data> <PathGeometry > <PathGeometry.Figures> <PathFigureCollection > <PathFigure StartPoint="43,0"> <PathFigure.Segments> <PathSegmentCollection > <PolyLineSegment Points="43,0"/> <PolyLineSegment Points="86,25"/> <PolyLineSegment Points="86,75"/>

How do you assign a “rect” attribute to a pygame.sprite.rect rectangle in Pygame?

你说的曾经没有我的故事 提交于 2021-02-04 07:41:49
问题 This question has been asked before, but the code they answer doesn't apply to me. I want to check when two rectangles collide in my game, and for the circle, I put a rectangle behind the circle(it's colored black). However, when I run, I get an error saying the rectangle needs to have a rect attribute. Here is my code: clock = pygame.time.Clock() pygame.init() change = False screen = pygame.display.set_mode((400, 300)) done = False x = 100 y = 30 bound = False while not done: for event in

How do you assign a “rect” attribute to a pygame.sprite.rect rectangle in Pygame?

痴心易碎 提交于 2021-02-04 07:41:29
问题 This question has been asked before, but the code they answer doesn't apply to me. I want to check when two rectangles collide in my game, and for the circle, I put a rectangle behind the circle(it's colored black). However, when I run, I get an error saying the rectangle needs to have a rect attribute. Here is my code: clock = pygame.time.Clock() pygame.init() change = False screen = pygame.display.set_mode((400, 300)) done = False x = 100 y = 30 bound = False while not done: for event in

Overlap between mask and fired beams in Pygame [AI car model vision]

房东的猫 提交于 2021-02-02 08:51:26
问题 I try to implement beam collision detection with a predefined track mask in Pygame. My final goal is to give an AI car model vision to see a track it's riding on: This is my current code where I fire beams to mask and try to find an overlap: import math import sys import pygame as pg RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 255) pg.init() beam_surface = pg.Surface((500, 500), pg.SRCALPHA) def draw_beam(surface, angle, pos): # compute beam final point x_dest = 250 + 500 * math.cos

Make an object collide with certain other objects when moved to RaycastHit point in Unity3D?

人走茶凉 提交于 2021-01-29 19:33:59
问题 I'm making a simple building system using Raycasting from the mouse pointer. The object that is to be placed is moved (and cloned on click) to the RaycastHit.point of the ray, but I want it to fully collide with objects of its own type, shifting its position relative to the hit point. The object can intersect the terrain as shown in the gif, but should not be inside of the already placed wall blocks. I tried using hit.distance but couldn't figure the detection out, since the object is being

C++ Plane Sphere Collision Detection

荒凉一梦 提交于 2021-01-29 10:15:42
问题 I'm attempting to implement Sphere-Plane collision detection in C++. I have a Vector3, Plane and Sphere class. #include "Vector3.h" #ifndef PLANE_H #define PLANE_H class Plane { public: Plane(Vector3, float); Vector3 getNormal() const; protected: float d; Vector3 normal; }; #endif I know the equation for a plane is Ax + By = Cz + D = 0 which we can simplify to N.S + d < r where N is the normal vector of the plane, S is the center of the sphere, r is the radius of the sphere and d is the

pygame collision detection causes my computer to hang

瘦欲@ 提交于 2021-01-28 02:53:24
问题 I am trying to make a game similar to agar.io. I have a blob which is controlled by the player. It can move around and eat food. There is a different class for food as well. 200 instances of the food class is created: def spawn_food(self): if len(self.foods) <= 200: self.foods.append(Food()) Everything upuntil now is working fine, however, my entire computer hangs if i try to run the collision detection between all the foods and the blob. This is the code: def ate(self): for food in self

Simple Javascript collision detection?

混江龙づ霸主 提交于 2021-01-27 06:01:32
问题 I'm trying to make a simple game using jquery,javascript,html and css. I keep getting stuck on collision detection. code: var map = [ [0,1,0,0,0,1,0,0,], [0,1,0,0,0,1,0,0,], [0,1,0,0,0,1,0,0,], [0,1,1,1,0,1,0,0,], [0,0,0,0,0,0,0,2,] ]; function DrawMap() { for(var i=0; i < map.length; i++){ for(var j=0; j < map[i].length; j++){ if(parseInt(map[i][j]) == 0){ $("#container").append("<div class='air'></div>"); } if(parseInt(map[i][j]) == 1){ $("#container").append("<div class='block'></div>"); }

Simple Javascript collision detection?

故事扮演 提交于 2021-01-27 06:01:15
问题 I'm trying to make a simple game using jquery,javascript,html and css. I keep getting stuck on collision detection. code: var map = [ [0,1,0,0,0,1,0,0,], [0,1,0,0,0,1,0,0,], [0,1,0,0,0,1,0,0,], [0,1,1,1,0,1,0,0,], [0,0,0,0,0,0,0,2,] ]; function DrawMap() { for(var i=0; i < map.length; i++){ for(var j=0; j < map[i].length; j++){ if(parseInt(map[i][j]) == 0){ $("#container").append("<div class='air'></div>"); } if(parseInt(map[i][j]) == 1){ $("#container").append("<div class='block'></div>"); }