xna

XNA View Matrix - Seeking explanation

风格不统一 提交于 2019-12-21 02:34:27
问题 I'm having some serious trouble understanding the view matrix in XNA. I've come pretty far with all the other parts and since I've just learnt myself the required maths I don't want to use the built in Matrix-functions without understanding what they do first. Now I understand the basics of rotation, projection and translation but I can't for the life of me understand how the view matrix works in XNA. From what I've gathered, the view matrix should transform the "world" to it's own space.

Angle between two Vectors 2D

廉价感情. 提交于 2019-12-20 10:38:20
问题 I'm trying to compute the angle between two vectors. I tried this, but it always returns zero: public double GetAngle(Vector2 a, Vector2 b) { double angle = Math.Atan2(b.Y, b.X) - Math.Atan2(a.Y, a.X); return angle; } GetAngle(new Vector2(1,1), new Vector2(50,50)); 回答1: You should take a look at the documentation of atan2 (here). What you're looking of is finding the difference between B (your upper left vector) and A (your bottom right vector), then pass this as a parameter to atan2 return

Viability of C#/.NET as the new standard game dev platform?

做~自己de王妃 提交于 2019-12-20 08:41:00
问题 For a long time now C++ has been the dominate game development language. Many AAA quality 3D engines are available to fit any budget. My question is, with the rise of XNA, has C# and the .NET framework been positioned well enough to take over as the new standard game development platform? Obviously the inherent cross-platform nature of the XNA framework (Windows, Xbox, Zune) has its benefits, but are those benefits good enough to entice large game dev studios to switch gears? Personally, i am

Homing Missiles, How Do They Work?

南楼画角 提交于 2019-12-20 07:58:38
问题 What I am trying to create An object that will launch a missile towards the player, if it collides with player, player dies. The Problem How does the missile move towards the player. How do I make the missile move so that it does not instantly move directly towards the player(to slowly move on an angle). I have a formula for the mouse to be the "Player" and the missile to go towards it. mouse = Mouse.GetState(); mousePosition = new Vector2(mouse.X, mouse.Y); A = (mouse.X - Position.X); B =

HLSL and Pix number of questions

僤鯓⒐⒋嵵緔 提交于 2019-12-20 05:58:22
问题 I'm having a number of isses with HLSL and Pix. 1) Can you in HLSL 3, declare a Pixel shader alone without a Vertex Shader? If not, what can I do to get around this? 2) Why does Pix skip code? I have a reasonably long shader method but Pix seems to stop me from debugging until half way through the method and then skips the rest of the block. I set Pix to gather information when F12 is hit and check the DISABLE D3DX analysis checkbox. I have to do this because I'm using XNA. 3) Can I debug the

Xna draw order not working right

大兔子大兔子 提交于 2019-12-20 05:52:44
问题 I have an 2d array of Texture2D, it holds the different parts of the map in this array. I have a problem though, when I run the game, the map is drawn correctly but for some reason the array[0, 0] texture overlaps all my textures including my player texture and mouse texture. Every other texture works as my mouse and player texture correctly overlaps the map. I'm really confused right now as the map textures are being drawn together using a nested for loop. Here is my draw method for my map

How to use DirectX.DirectInput in XNA

走远了吗. 提交于 2019-12-20 05:15:40
问题 joystick.cs using System; using Microsoft.DirectX.DirectInput; namespace gameproject { /// <summary> /// Description of device. /// </summary> class joysticks { public static Device joystick; public static JoystickState state; public static void InitDevices() //Function of initialize device { //create joystick device. foreach (DeviceInstance di in Manager.GetDevices( DeviceClass.GameControl, EnumDevicesFlags.AttachedOnly)) { joystick = new Device(di.InstanceGuid); break; } if (joystick ==

How to use DirectX.DirectInput in XNA

你离开我真会死。 提交于 2019-12-20 05:15:28
问题 joystick.cs using System; using Microsoft.DirectX.DirectInput; namespace gameproject { /// <summary> /// Description of device. /// </summary> class joysticks { public static Device joystick; public static JoystickState state; public static void InitDevices() //Function of initialize device { //create joystick device. foreach (DeviceInstance di in Manager.GetDevices( DeviceClass.GameControl, EnumDevicesFlags.AttachedOnly)) { joystick = new Device(di.InstanceGuid); break; } if (joystick ==

Windows forms and XNA - Draw is not realtime

一个人想着一个人 提交于 2019-12-20 04:25:26
问题 I am currently working on a Level Editor for XNA which is built by combining Windows Forms and XNA. I am using stuff from the example on App Hub link text, but I have made some changes, so I have some ViewportController class which manages all the viewport controls, instead of the form manages them directly. The problem is that when I need to update the Draw method I have to shake the window. Anybody knows how to fix this, so the Draw will update realtime? 回答1: Not sure what a

XNA performance on WP7

白昼怎懂夜的黑 提交于 2019-12-20 03:55:09
问题 I'm trying to get the frame rate of my XNA game on WP7 up to 60 fps. It appears to be locked at around the 30fps mark. I've tried the change of but makes little difference. PresentationParameters.PresentationInterval = PresentInterval.One Any thoughts? 回答1: You can change the fixed time step that XNA defaults to: // 166666 ticks is 16.6ms, which is 60hz game.TargetElapsedTime = new TimeSpan(166666) // 'game' refers to your instance of XNA.Game Here's documentation on the feature: http://msdn