Answer Questions
smartpi Camera position?
How do I calculate the current position, target and up vectors once Matrix transformations have been applied to Device.Transform.View r3n, Ah, sorry I wasn't clear. You would take your view space camera position (right, up and look vectors) and multiply this by the inverted view matrix to get the world space position vectors. To make it more clear, if matrix A holds equations that will transform points from coordinate space A to coordinate space B, then the inverse matrix of A, say matrix B holds the equations to reverse this. So if you have a point, say point 1, in space A (view space) and you want to world space of this point you would multiply this point by the inverse matrix of space A. Sorr ...Show All
HarveyC123 Possible that Update() is multi-threaded?
I'm getting a REALLY strange exception. It only occurs when I run my game via Ctrl-F5 (rather than F5) and even then I can't always reproduce it. It's in a bit of code that is simply a foreach-loop on a List<> of Particles and calling Update(elapsed) on each of them. The error occurs on the first line of Particle.Update() which is "base.Update(elapsed)" which calls the Sprite class' Update()... which has no indexes in it. At the end of the loop I look for any particles that need to be removed from the list and do so. Based on what little debug information I can get, it looks like it's an internal error in System.Collections.ListDictionaryInternal... Count is zero, which pretty much should never be the case... there's alw ...Show All
r2d2-proton Just saying Hi
Hi! I have wanted to make a game for some time now... and I never really wanted to put much time into it until now. I have the whole game drawn out on paper (classes, skills, the way the networking works) but never got around to implementing it. I have been playing with this XNA GSE and have a car that I can drive around a track. Hopefully I will have more soon. I would like to "build up" to my main goal which is the game I was talking about before, but that includes animation which I am waiting for a nice example/tutorial for. Anyways, just figured I'd say Hi and I'm sure I'll be able to help out with normal programming stuff for now (I'm a software engineer for 2 years now), and maybe others can help me out with ...Show All
GazCoder D3D10 Sprites are insane.
I'm trying to draw a single sprite to the screen. I have a window created (640,480) and the texture loaded in properly. The sprite drawing uses the code below in a Render() function. When run, the sprite does show up but is either tiny when scaling is not applied or skewed when scaling is applied. I know i'm messing up the scaling value, i'm just confused on what the formula should be for calculating it. Right now, i'm using example code from DXUT.cpp which says the scale should be (windowx/textureWidth) and (windowy/textureHeight). This gets the sprite close, but the result is skewed. Could someone please take a look at the code below and see if you see any glaring issues Thanks. Render() { // clear the target buffer ...Show All
Freddo using C++ libraries with C# and 360...
Hey Guys, Up until now, all of my projects have been written in cpp. I had a pretty descent game engine written based upon Ogre3D and several other libraries but I kinda abandond the project when xna was released. Anyway though, Im currently still in the process of learning c# however, as soon as I have the language down pretty well, I want to go ahead and start recreating my game engine using xna instead. The only problem is, well, honestly, I'm just not good enough with my 3D maths and physics yet to create my own C# physics engine so I was hoping I could use the Novodex physics engine with C# although it's written in C++. Is this possible Can you #include the headers into your c# code Does the compiler still support c++ And last but no ...Show All
Dan.Jurden Best Practices
I'm a big fan of FxCop and best practices when developing .NET applications and any API's. Are there any documented best practices when using the XNA Framework Are there any plans to add an FxCop module for XNA Cheers, Steve Dunn. I think "No" is the answer to both. You could make a suggestion for the FxCop module. There is nothing official right now. I would, of course, recommend reading and applying the .NET Design Guidelines when developing APIs. We are currently looking at how do we illustrate some common design patterns used in games today and how they apply to the XNA Framework to help those that aren't familiar with them. We've also discussed FxCop extensions to assist in X ...Show All
TheBlackDahlya Vector Math Help
I'm having a problem...I have a ship heading in a direction VectorA and a gravitational force pulling it towards an object, when it collides with that object, I need to bounce it off that object into the correct direction, (180 - angle of collision), but I cant figure out how to get it to head in the proper direction at the correct speed. if (shipBounds.Intersects(sphereBounds) == true ) { double yoffset; double xoffset; double returnangle; yoffset = ( double )(playerShip.Position.Y - sphere1.Position.Y); xoffset = ( double )(playerShip.Position.X - sphere1.Position.X); returnangle = Math .Atan(yoffset / xoffset); returnangle = (double)MathHelper.ToRadians(180) - returnangle; playerShip.Velocit ...Show All
Jon Prudhomme ContentManager.load<MyClass>(filename)
hi i have a proplem i have created a xml file look like this: < xml version = " 1.0 " encoding = " UTF-8 " > < XnaContent > < Asset Type = " EvoFxEngine.EvoFxMesh.EvoFxMeshProcessor " > < EvoFXMesh > < EvoFXProperties > < EvoFXVersion Version = " 0.5 " /> < EvoFXName Name = " SkyDomeMesh " /> < EvoFXClassification Classification = " SkyObject " /> < EvoFXNumberOfVertex NumberOfVertex = " 55 " /> < EvoFXNumberOfFaces NumberOfFaces = " 80 " /> </ EvoFXProperties > < VertexData > < Vertex X = " 2102,924 " ...Show All
Jhedron Contour offset of a polygon
Dear All, I am using DirectX to write application and I cannot figure out how to do this: I have a polygon and I want to create inward contours offset of that polygon by giving number of contours that I want and the distance from one contour to another as well. I would highly appreciate if anyone can advise me the algorithm of doing this Regards, LG A google seatch with "cel shading hlsl" keywords gives lots of results: You can try the one on this page to start with. Also I know there's a tutorial on nehe website . It is in OpenGl but it can help understand principles... Cel shading technics are using a "sort of "coutour extraction algorithm. So if you manage to unders ...Show All
Harry_Leboeuf Game.GameServices article
I put up an article about Game.GameServices and the IGraphicsDeviceService. http://blogs.msdn.com/mitchw/archive/2006/09/06/742955.aspx Hey your post beat my rss reader, lol And thank you for more info on the IGraphicsDeviceService sound like it will come in useful with components Thanks, was looking for something like this. Thanks Jason, it worked beautifully. I ended up writing an article for OpenXNA... http://www.openxna.net/node/60 Good explanation. Hope this can be written into XNA doc. But I still have some questions: 1) When is the service registered and when is it unregistered for a GameComponent 2) What happens if two GameComponent provides the s ...Show All
Marcos Bertoldi A very simple terrain component.
Hey, I was inspired by the game components demo Mitch put up the other day, to toss together a terrain component of my own. Just be sure to supply it with a texture. 'N' generates a new terrain on the fly. It uses the BasicEffect for rendering (cudos to Microsoft for ditching fixed function). The Perspective, World, and View matrices are all hard coded though, so you can't move around or anything. Hopefully someone finds it useful. using System; using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Components; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Storage; namespace Game_Project { public parti ...Show All
danni123 Creating objects 'by name' read from level data
Hi, Firstly sorry for the confused subject line ;) Ok, I'll try and explain - suppose I have a class called Enemy1 and a text file that lists level data and in there I have the text "Enemy1" listed also. Can I somehow create a new instance of an Enemy1 object by only knowing 'Enemy1' as the string that I have read from the level text file This would mean I would avoid alot of code such as 'if blah = "Enemy1" then... Enemy1 myEnemy = New Enemy1' etc. Hope that makes sense, sure there is a 'correct' name for this. Cheers :) The Activator.CreateInstance will do this for you. It has many overloads, some where you give it a Type instance, others where you pass strings for the type name and assembly. ...Show All
Ljhopkins I want to learn how to draw sprites with C#!!!!
I need help drawing sprites in C#!!!!!!!!!! Any Help..... Any Code..... What do you mean by sprites Irregular shapes To do any sort of gaming, you need to learn DirectX. Where can I learn directX You need to download the SDK, it comes with lots of samples, and there is a DirectX101 forum in this forum group. ...Show All
Eric Liprandi Question regarding making landscape in 2D
My question is rather simple. I have a texture and a landscape map to apply it to. It is possible to make a rectangular sprite in XNA, but is it possible to cut a part from it Here's an example for better understanding of what I'm aiming for: http://img335.imageshack.us/img335/9972/examplent7.jpg The only way I can think of is to make a different texture for every sprite, changing its shape every time. But that really it not the easiest and smartest way... Here's an example of a single landscape part: http://img151.imageshack.us/img151/8537/partaq9.gif I didn't realize from your original post that you were trying for nonrectangular shapes. Landscapes typicall ...Show All
Ajan246 Draw 1 Line?
How can I draw a single line in XNA LineList dosent seem to work with a single line. Here is a simple class that should draw a single line(rest of the code missing). It gives unexpected results. If I increase the number of primatives in the DrawPrimatives call it draws more lines, even though I sent the buffer only 2 vertices. It must be using old data from the buffer. Can you just draw a single line Thanks public class Line : IGeometry { public VertexPositionColor [] vertices; private VertexBuffer vertexBuffer; public Line( VertexPositionColor vertex1, VertexPositionColor vertex2) { vertices = new VertexPositionColor [2]; this .vertices[0] = vertex1; this .vertices[1] = vertex2; } ...Show All
