Tag Info

New answers tagged

2

This is more of a design decision, since objects are implicitly references in Java, so it really doesn't make much difference to be copying an extra reference. I'd suggest you just do whatever works first and then, if you feel you need to, start to optimise/change things and see if you get a better result. That's the best way to learn.


2

you are in a voxel engine which means that each box should have a discrete x, y and z coordinate thus: if you have a box at index (x, y, z) then you can get all neighbouring boxes by getting the boxes at index (x, y +/- 1, z), (x +/- 1, y, z) and (x, y, z +/- 1) edit: after some more info... just detect the collisions for a line between the center of the ...


0

I have a 'full width UI' script that deduces the aspect ratio of the screen relative to some reference screen dimensions, and adds a scale to the transform to compensate for a change in aspect ratio. Then I build my UI to the reference screen dimensions (in my case 1024 x 768). At runtime, the actual screen width is asked for, and the adjustment ratio ...


0

You could model this as a perfectly inelastic collision. That means that the players will keep touching each other after the collision. Suppose you have two players A and B running at each other at the same speed. A is heavier. So when A and B collide A pushes B backwards and keeps touching B. That seems to me realistic enough when we are talking about ...


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 ...


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 ...


0

Forgive me if I didn't understand your question (just comment below and I can modify my answer) but it sounds like what you need to implement is something like a "Slide along wall" if you detect that the player is going to hit a wall. Usually I would implement this as a swept-sphere against plane test, or a capsule for plane test. I'm sure you can find ...


1

You can freeze rotations of a Rigidbody.


2

Add a character controller and use controller.move() with this you can make your character don't walk through the walls, if this wall have a collider.


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 ...


0

There are several solution to your problem. The first solution i can think of is instead of using one rectangle you can use 4, or even 9+ if you need more detail. Put a top-left, top-right, bottom-left, bottom-right rectangle within your main rectangle. When you have the collision you currently have you can check on the more detailed rectangles and see where ...


0

By using continuous agent positions on a tiled map, the translation from a tile-list path to a points-list path is best served by a Funnel Algorithm. Basically doing what you have been, but only checking intermediate tile-vertices on the path that are next to an obstacle (which will naturally be where the tile-path has a bend). I see ray-tracing as ...


0

Yup there are multiple ways you can go around completing this and it really depends on how you are implementing a movement system and if there's a physics engine in the game. If there is no physics engine in your game and you move only by touching squares, I would suggest you implement a future check system. Where you have a large 2d array that hold the ...


1

The first polygon is not convex, swapping vertex 3 and 4 solved the problem


0

AFAIK Seperating Axes is only for detecting overlap, it can't be used to determine closest points in non-overlapping cases.


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

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 ...


0

To get onTriggerEnter events, you need to set the Is Trigger flag to true.


0

If you think they might intersect, find the intersection point(s) (likely two). Otherwise: Compute the points closest to {A, B, C, D} on each of the lines (containing the segments) on the other OBB. If these points are withing the segments then compute the distance and store it if it's the shortest distance so far. Otherwise: Go to 3: Check on which side ...


0

It depends on how advanced you want it to be. The simplest solution I'm aware of given your setup is merely "push back" anyone who collides. As in, if the player collides with an enemy during this frame, put the player against the edge of the enemies hit box. // An example of when the player is walking to the left if (rect.x < enemy.rect.x + ...


0

Use interfaces (available in Java 6). If all objects collide under the same loop, then you can have them all implement the same functions but perform different logic. ICollidable{ bool CollidesWith(ICollidable other); void handleCollision(ICollidable other); void reactToCollision(ICollidable other); } GameObject implements Icollidable { ... void ...



Top 50 recent answers are included