Tag Info

New answers tagged

4

You can reduce the instruction count by using vector operations: e.g. instead of edr = bool4((w1.x < w2.x) && ir_lv1.x, (w1.y < w2.y) && ir_lv1.y, (w1.z < w2.z) && ir_lv1.z, (w1.w < w2.w) && ir_lv1.w); you can write edr = (w1 < w2) && ir_lv1; Operators in HLSL ...


4

I got this working. It does not use the hqx filter, it uses the xBR filter (which I prefer). For me, this is not a problem. If you require the hqx filter then you'll want to convert the .cg files into their appropriate XNA equivalent. For completeness and searching reasons, I will be editing the question to be more concise and then posting all the relevant ...


0

I could pass the character controller the array of points representing the island that it is currently colliding with, but then iterating through all of the points and finding the points closest to the character seems like a lot of work to do on each frame When the collision first occurs you could save the id/index of the point in the array that is ...


-1

It's best to do all of this in the GPU using the World and View matrices, not by modifying where you draw the objects on the CPU. That way, you can change the camera arbitrarily (even zoom it in and out!) and it will just magically work. You can still do view culling as well to save on draw time. And none of your code for drawing the world will have to ...


3

The BSP method is apparently the most popular method for generating dungeons, but it's not the only one. For completeness I'll explain the generator that worked for me. I have to admit that I don't recall where I read about this so I'll just say that it's not my invention. A maze with rooms The basic idea is that a dungeon is a maze with rooms, sort of. ...


2

You could just store a second image (or use the alpha channel of your image) to store a heat map (this also depends a bit on how you're drawing this, e.g. through a canvas). You just create some mapping and tint areas in their specific color (example): Left arm becomes red. Right arm becomes orange. Left leg becomes cyan. Right leg becomes blue. As an ...


0

thank you for your answer. I've implemented the portal in my game. I use OverlapArea to check if there are objects near the portal and duplicate them to next portal. And if the objects leave the portal, I delete all objects that are not visible by the camera. You can see the effect here.


0

So I have found the solution at last :P the problem was the position of the Touches were in pixels and i took them as for screen coordinates. So to fix it, float resultant_magnitude = Info.half_height / camera.orthographicSize * (prev_touch_position - t.position).magnitude; replace the above by this : float resultant_magnitude = Info.half_height / ...


0

Common, easy but ultimately wrong answer Iterate along the vector in very small increments. Eventually they'll de-penetrate at a "reasonable" position, assuming you continue any additional constraints at each iteration. It's brute force, and for something simple, it's good enough. You will almost certainly need to add artificial max/min force limiters to ...


0

The simple solution is to not pre-render the background at all. Draw everything live, in 3D, with a fixed camera angle. Modern GPUs can achieve live results that look better than what we often had to pre-render for back in the day (especially with good art). That said, if you want to reproduce the technique for "authenticity," efficiency, or simply to ...


1

My solution would me to create 2 identical objects that are spaced apart by the width of the screen.So when the first object is in the middle of the view (for example left one), the other object would be screen width apart from the first object i.e. off the view. When you move the first object the second one moves along with that object, keeping the space ...


2

You may do what you need in 2 step: Clustering: First you can cluster your point. There are many clustering algorithms which will put your points into multiple close-distance group. K-means is one of your options. Convex Hull: Then you can create Convex Hull for each cluster. such as: Gift wrapping algorithm, Quick Hull, Bridge, ... There is a trade-off ...


1

If you look at a circle with the angles marked you will see that 270 degrees corresponds with (0,-1) i.e. straight down. By convention degrees are marked as acceding in a counter-clockwise direction. They do however form a loop and as such 270 degrees (purple arrow) can also be expressed as -90 degrees (orange arrow) i.e. a quarter turn in the opposite ...


0

X = x*cos(θ) - y*sin(θ) Y = x*sin(θ) + y*cos(θ) This will give you the location of a point rotated θ degrees around the origin. Since the corners of the square are rotated around the center of the square and not the origin, a couple of steps need to be added to be able to use this formula. First you need to set the point relative to the origin. Then you ...


0

It is a common technique to rotate a point about a pivot by translating to a coordinate system where the pivot is the origin, then rotating about this origin, then translating back to world coordinates. (A very good explanation of this approach is available at Khan Academy) However you are not storing your rectangle corners in world coordinates so we can ...


0

See the Wikipedia article on rotation. The essence is this: (1) If c is the center point, then the corners are c + (L/2,W/2), +/- etc., where L and W are the length & width of the rectangle. (2) Translate the rectangle so that center c is at the origin, by subtracting c from all four corners. (3) Rotate the rectangle by 40 deg via the trig formulas ...


0

Kerbal Space Program used to have the same issue, and called it the Kraken. They solved by moving the bubble around the player it has a radius of 2.5 kilometers outside of which all objects end up "on rails" where the orbit is fixed and large jumps ahead are easily calculated. That can be done using the patched conics orbit model. Essentially it means ...


1

The best way to get around these types of limitations is to move the world, rather than move the player and camera. Strict Method Keep your camera and player at (0,0) if you're using 2D or (0,0,0) is you're using 3D. When you calculate the input to move your player, instead of moving them, move all the objects in the environment. When the objects get some ...


0

If your room take up the whole game screen (a bit like your image), there not much you can do, because you do need to have part of that orange circle both on the left and on the right of the screen. If your world is large and you platformer center its view on the character, there's more hope. Let's say your world has a width of h. For example, split your ...


1

I imagine it's because you're only passing the iterators i, j, k to SetCell which will limit cell placement to 60 along all three axes, creating the outline of a cube.



Top 50 recent answers are included