Tag Info

Hot answers tagged

5

No, there's no way to do this. What you're looking for is a container, that holds references to rectangles that are insides its bounds. This isn't an easy thing to do when you really think about it. There is no way for the rectangle object to know any other rectangle object exists, let alone know if one is inside of it or not. However, there is a few data ...


2

The simple approach is just this: Each entity remembers what cells it is in. Each time the entity moves (or rotates or changes size or etc), check whether the cells it is in post-moving are the same as the cells it was in before moving. If the pre-move cells are the same as the post-move cells, do nothing. If there are any differences, update the grid by ...


2

Each cell is a data structure such as a List, or an object containing such a data structure. AFAIK this is not the way how it is usually implemented. This way you will waste lot of memory for arrays or lists, and lot of CPU cycles for manipulating them. For example, 32x32 grid will result in 1024 arrays/lists, and this will be especially bad with ...


1

Collision callbacks are explained in http://www.bulletphysics.org/mediawiki-1.5.8/index.php?title=Collision_Callbacks_and_Triggers. This translates quite straightforward to JBullet. However if you have already tried and failed to follow that, I'll just provide the code I have been using myself. First set-up a callback that is called on every physics ...


1

As far as I know, most programs will separate geometry for rendering from geometry for physics. (This is because rendered models can be incredibly detailed, and hit testing against each polygon will take way longer than say, a couple quadtree intersection tests.) If you're using a small number of simple rectangles, you could simply test each rectangle ...


1

You stated that it will be a MMO game - don't do this kind of stuff client-side. You will have problems with cheaters, because it's fairly easy to modify your code so they can fly/no-clip etc. If your terrain is heightmap-based just prepare your world so you have all of the objects inserted (houses, trees etc.) and generate some kind of mask which will ...


1

Well what I do for my 2D game is that inside of checking before the players moves, I deal with collision after the player moves. Before I used to run into problems like yours because of the fact that when you check before hand, you stop the player from moving. Heres what you have to do, lets say that there is a block at some x, y, width and height ...


1

With only the given information I would assume one of a few scenarios is happening here: Something very mysterious because you provided very little information Your player is on the enemy layer and subsequently the ray immediately hits the player You are not setting up your EnemyLayer variable correctly. To filter a Raycast based on layer you need to set ...


1

A negative solution means that the time at which that separation distance occurred is in the past. An imaginary (or complex!) solution means that the time at which that separation distance occurred neither has, nor ever will, occur. This is the meaning of the square-root term being negative.


1

Change the frame of reference and everything will become wonderfully simple. You currently have: sphere A (position Pa, velocity Va, radius Ra) sphere B (position Pb, velocity Vb, radius Rb) In terms of collision detection, this is equivalent to: sphere A' (position at origin, velocity zero, radius Ra + Rb) point B' (position Pb - Pa, velocity Vb - ...


1

Explaining the provided link: The linear segments A(u) = A0 + u * Va and B(u) = B0 + u * Vb are just parametric representations of the segments Va = (A0, A1) and Vb = (B0, B1). You should recall that the vector can be represented by the difference of the end points. That's why Va = A1 - A0 and Vb = B1 - B0. A(u) and B(u) are said to be parametric ...


1

At the conceptual level, the way you do image-based collision tests in server code is by loading images into memory and operating on the grid of pixels they contain, either directly or by using helpful libraries. Image loading and manipulation libraries like ImageMagick and GraphicsMagick tends to have bindings to pretty much any platform in existence, and ...



Only top voted, non community-wiki answers of a minimum length are eligible