Tag Info

New answers tagged

1

I avoid Euler angles in aircraft pitch, roll, yaw orientations because aircraft rotate about thier local axis and trying to resolve this to Euler angles about the world (or global) axis adds uneccesary complication to the code. Instead of 3 Euler angles, I store the current orientation as a matrix or quat and simply modify the matrix/quat depending on input ...


2

You don't want to turn off depth stencil state. Leave that the way it was before. Giving the Problem a Name The problem you're having is that two objects are being drawn in almost identical locations, but because of floating point precision errors, at the different pixels, sometimes one turns out to be barely closer to the camera/eye than the other, and on ...


0

Occlusion query.... http://blogs.msdn.com/b/shawnhar/archive/2008/12/31/pixel-perfect-collision-detection-using-gpu-occlusion-queries.aspx It is described well enough there.


2

I found out that the Content.mcgb is actually a little GUI helper and you can generate and easily load a .spritefont file with it. Steps: 1.Load the GUI app by double clicking the "Content.mcgb" file in the "Content" folder 2.Go to Edit -> New Item... -> Choose SpriteFont and give it a name -> Hit "Ok" 3.Go to Build -> Build (or hit F6) - You should get ...


1

You're using vector3.up, vector3.forward and vector3.right to calculate the needed rotations. These axes don't move along with your plane. What you need to do is rotate the plane around its very own up, forward and right vectors. You could do that like this: Matrix rotMat = Matrix.CreateFromQuaternion(model_ROTATION); Quaternion additionalRotation = ...


1

Simply draw your sprite before the call to GraphicsDevice.SetRenderTarget(null);


0

Actually you can simply do: private static void Flush() { lastKeyboardState = new KeyboardState(); }


0

I'm assuming the rest of your code goes somewhat like this: if(KeyPressed(Keys.Enter)) bringUpMenu(); if(KeyPressed(Keys.Enter)) selectMenuOption(); and you want to flush the values somewhere in the middle? Well the solution I thought of would be to add the line "keyboardState = lastKeyboardState" to the first if ...


0

I just leave it here. click1, click2 (see UISystem and UIComponent) It's free and it works. If you have questions please ask me in comment or chat.


7

I would imagine a custom pixel Shader for the SpriteBatch would be the fastest method here. Using something like this: // WARNING! UNTESTED CODE FOLLOWS void SpriteVertexShader(inout float4 color : COLOR0, inout float2 texCoord : TEXCOORD0, inout float4 position : POSITION0) { if (color == float4(1, 1, 0, 1) color = ...


-2

As we talked about in the comments, using fonts aside from the default is extremely painful. I suggest you stick with the default. But, if you want to put yourself through it, you can use this tutorial. Sorry I cannot be more detailed than this...the memories are too distressing.


1

While it is true that approximating geometry with primitives is the general solution in collision detection, in this case that's not entirely true. What most engines do is use a triangle mesh for the terrain and a vertically oriented capsule for the character. To keep the cost of testing down the triangle mesh is partitioned with some kind of spatial ...


0

Expanding @Silveor answer, Pixel is smallest part of image. You cannot divide it more. Because Pixels are integers. They are the smallest part on your monitor. All you can do, is color the monitor's pixels, with a certain color. Therefore, saying to the graphics card "draw me this image at (0.1f,100) position" makes no sense, because it will be ...


1

Nothing. Pixel is smallest part of image. You cannot divide it more. If you don't want smooth image then humble with it. :| BUT! Problem also can be in how you calculate draw positions. See first answer on this question. It can helps you. If not please post code of your Draw method.


1

I would agree that it would be best to go fully 3D billboard with this. You can do this without shaders (well, you would use the built in BasicEffect which is an already written shader for you). Move the camera away from the scene and decrease the FOV. here's why: When you move the camera close to the scene and widen the FOV, the close fighter (blue ...


0

A sidescroller involves you having 2 background images then when one's position crosses the screen it goes behind the other one and it keeps looping to this involves using Rectangle by the way i have a video for your problem exactly. https://www.youtube.com/watch?v=NZEzD0GvImg


0

Before you read this. This might only apply to 2D objects. I am a XNA user what i would suggest simply doing is if you can make a sprite sheet of the image you are merging constantly changing the position getting closer to the origin of the thing you are trying to merge and the end result would be merged. I do not know if you have any experience with ...


0

This is how I would do it: Vector2 targetPos = new Vector2(600,100);//target location float speed = 0.5f; public override void Update(GameTime gameTime) { //if the distance between the current position and the target position //is less than 10, then move it straight to the target position if(Vector2.Distance(targetPos, ...


0

If you ask how rotate particles to camera you can find explanation here. But if you want rotate particles around normal vector you must do it when you generate vertices. If you do it like in the toturial a privide tnen you can save information about offset of each vertex of plane in that vertex, For example without rotation vertex offset for left top lertex ...


1

Assuming you created your triangle strip in Model Space. Use Matrix.CreateBillboard to create a transformation matrix that will rotate your triangle strip towards the camera. Note the below values should be in World Space. public static Matrix CreateBillboard ( Vector3 objectPosition, Vector3 cameraPosition, Vector3 ...


0

Try see this tutorial, it can be what are you looking for. P.S. I'm test my implementation of it with 1,000,000 enderman eyes (original 16x16 pixels texture) and performance was pretty good.


1

First draw your bubbles with basic shader to RenderTarget2D texture. Next draw sprites shat should be blured with custom shader and pass it as BlurMapTexture paramether. In this shader add sampler for blur map: texture BlurMapTexture; sampler2D blurMapSampler = sampler_state { Texture = (BlurMapTexture); MagFilter = Point; MinFilter = Point; ...


0

The default shader is not designed for this. You will need either a custom shader or need to manually update the positions. This second option will have low performance, especially for large numbers of stars. The standard shader is: // in_p is the position from the vertex buffer p_camera = modelview * in_p out_p = projection * p_camera // out_p goes to ...


-2

I use a RenderTarget2D and then create a Texture2D out of that.


0

I am quite naive when talk comes about quad or oct tree. But I think that this method should do: You will need to modify the player structure/class. Add an array/vector of pointers to other player structure. Every second check distance between each two players. If it is so low that it is possible to reach within 1 sec then add that player's pointer to ...


3

You can do this in two ways, both of which require 3D cameras and projection: First, give all of your objects a 3D position in the world. // XYZ Vector3 Position; Next, create a camera with a position and orientation: class Camera { // Position of the camera in the world Vector3 Position; // Place where the camera is looking Vector3 ...


0

Assuming "LoadContent" gets called once at startup and "Update" gets called every frame, your issue is probably because the ball's X and Y coordinate got set to 5 every frame in the update method, therefore, it wouldn't be moving around freely... If it gets called once in the LoadContent method then it does not continually update the X and Y position to be ...


0

I have found the solution to this somewhere else. Adding a bigger if statement such as this : private int elapsedTime = 0; //Declared at class level public override void Update(GameTime gameTime) { elapsedTime += gameTime.ElapsedGameTime.TotalMilliseconds; if (elapsedTime > 500) { elapsedTime = 0; birdbox3.X += 5; birdbox3.Y -= 5; ...



Top 50 recent answers are included