collision-detection

How to detect collision in webgl?

☆樱花仙子☆ 提交于 2020-01-11 02:27:29
问题 How to detect collision in webgl, without using any library like three.js? 回答1: How to detect collision in webgl You don't. WebGL, like OpenGL is only for drawing stuff. It doesn't manage a scene, it has no notion of "objects" or such high level things like collisions. It's all about points, lines, triangles and shaders. Anything related to scene management or collisions lies outside the scope of WebGL (and OpenGL). 回答2: A simple approach it to do ray collision detection on the GPU. Checkout

Image collision/intersection in JavaFX

我只是一个虾纸丫 提交于 2020-01-07 04:30:32
问题 I am trying to develop a game in javaFX where score will be updated and obstacle will be invisible when two images will intersect.But unfortunately,in the game score is updating continuously. I think i can not make the image invisible properly in game. Here's the full code of related class: package minion.Model; import javafx.animation.TranslateTransition; import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Group; import javafx.scene.Scene; import javafx

Java Pong ball glides on paddle

无人久伴 提交于 2020-01-06 08:15:42
问题 im making a pong game in java, i've run into a problem. The bug is that when the pong ball intersects with either the AI or player paddles, the ball will sometimes collide multiple times. It basically looks like like the ball is gliding on the paddle. Sometimes, the ball will even get stuck behind the paddle infinitely. Had anyone ever encountered this error or something similar? I am confused with this multiple collision stuff :( my ball class is below: package ponggame; import java.awt.*;

Collision detector in javafx (2d maze)

血红的双手。 提交于 2020-01-06 08:07:21
问题 How do I make my ball bounce off objects on the screen? The picture below is a good example of how the program should be working once the ball runs into an obstacle. I made the ball bounce off the walls, but what's left is making it also bounce off objects. Thanks for the help! Here's the source code: public class 2DGAME extends Application { public static Circle circle; public static Pane canvas; private long counter = 0; double X = 0; double Y = 0; @Override public void start(Stage

AS3 - Finding the highest y-coordinate for a given x-coordinate in BitmapData?

和自甴很熟 提交于 2020-01-06 02:59:07
问题 I'm making a platformer. Here is what I have so far: http://megaswf.com/s/2486396 (move around and jump with arrowkeys). I'm using the ground's bitmap data to test collisions with the player's coordinates, and the player is sinking into the ground a few pixels (especially when walking uphill). To prevent this, I want the player's y coordinate to instantly change so that the player is sitting on top of the ground. Here is what I'm working on: if (groundClipBmpData.hitTest(rLoc, 255, bLocFuture

Can't get collision detection or onclick to work in THREE.js

◇◆丶佛笑我妖孽 提交于 2020-01-06 01:56:10
问题 I've spent 2 days now trying to get this collision detection and click on object to work, with some luck but not close to perfect. I want to detect the camera's collision with objects as it moves around the scene (like if it were a shuttle and it would go boom if you ran into a planet or sphere). Any help would be greatly appreciated. FYI, ShipControls are a clone of FlyControls (slightly modified). Example: http://www.benmarshall.me/projects/playground/solar-system/index2.html 回答1: Ray doesn

Have object detect if completely inside other object JavaScript

断了今生、忘了曾经 提交于 2020-01-05 08:39:22
问题 Hello I'm making a game for my CS class using JavaScript. I know how to ale objects collide with each other in the canvas but I m trying to get an object to detect if it's completely inside another object If (object1.xcoord > object2.xcoord && object1.xcoord + object1.width < object2.xcoord + object2.width && object1.ycoord + object1.height < object2.ycoord +object2.height) { alert("hi") } Note I only need those three sides it doesn't matter to me if object 1 is within top side of object 2

Simple Collision Detection - Android

心不动则不痛 提交于 2020-01-04 14:07:23
问题 I want to do really simple collision detection in a pong like game. The ball is a square and the paddle (bats) is rectangles. I have two entities coming in where I can get the current X and Y position, and the bitmap height and width. Which is the simplest way to do this? I have this code: public void getCollision(Entity enitityOne, Entity enitityTwo){ double eventCoordX = (enitityOne.getCenterX() - (enitityTwo.getBitmapWidth() / 2)); double eventCoordY = (enitityOne.getCenterY() -

Simple Collision Detection - Android

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-04 14:06:07
问题 I want to do really simple collision detection in a pong like game. The ball is a square and the paddle (bats) is rectangles. I have two entities coming in where I can get the current X and Y position, and the bitmap height and width. Which is the simplest way to do this? I have this code: public void getCollision(Entity enitityOne, Entity enitityTwo){ double eventCoordX = (enitityOne.getCenterX() - (enitityTwo.getBitmapWidth() / 2)); double eventCoordY = (enitityOne.getCenterY() -

Fast projectiles don't always hit

血红的双手。 提交于 2020-01-04 06:33:53
问题 So for my game, a have a fast moving Bullet object, with a sprite that's 5x5 (roughly). Moving at about a speed of 30, it needs to impact a relatively thin Enemy object with a thickness of only about 5 pixels. At certain regular intervals of distance, the Bullets pass through the enemy without a collision. I think its because the bullet is moving so fast that it happens to "jump" over the enemy, hence the regular intervals. other than increasing the width of the Bullet or Enemy, is there a