So I decided to improve things by removing any reference to outside classes (including InputState which is no longer required) I realized this update is necessary as even I found it difficult to implement the gizmo in a new project and wasn't a simple drag&drop operation as it should be (or as close as possible to it) this made it obvious some improvements were required to the public version.
The last public update was quite a while back and I was using a modified version with already several improvements implemented (such as multiple type of objects you can select as shown in the Vertex Manipulation Video where I select both scene objects and vertices with the same Gizmo component)
So in general the upcoming update should make it much easier for everyone to implement this gizmo into his own code/editor. If you had trouble integrating it, please let me know. There is no current ETA on therelease, but I'll try to do it sooner than later...
I saw your commit, nice work, waiting for more nice features :)
ReplyDeleteI think you've missed some files during commit, please check better.
ReplyDeleteYes, there was a problem with the SVN setup. I noticed this today on my laptop (original development is on my PC) so I can fix this tonight.
ReplyDeleteFurther tasks are mostly testing and compiling a release package for Codeplex.
Hi Tom,
ReplyDeleteIt seems I have some issue (version 1.0)with re-selecting the a cube when I'm moving the camera. I am selecting one of the cubes and then deselecting by clicking outside. I am moving the camera position (let say Engine.CameraPosition= new Vector(200,50,50)) in the Update method and I am trying to select the same cube. If I don’t click on the place where the cube was (on the screen) it is not possible. Any idea what I am doing wrong?
I think you forgot to update your View matrix. After updating your position you must update your view matrix accordingly. i.e:
ReplyDeleteEngine.View = Matrix.CreateLookAt(Engine.CameraPosition, Vector3.Zero, Vector3.Up);
I have significantly reduced the integration complexity in the upcoming release. I have noticed the current v1.0 can be a bit difficult to implement if you're unfamiliar with the code.
Hi Tom,
ReplyDeleteThank you for your prompt response. Consider the following modification in your Update function (version 1.0):
protected override void Update(GameTime gameTime)
{
k++;// added line (initialised as int)
if (k > 1500) k = 1500;// added line
Engine.CameraPosition = new Vector3(-5 +(k/10), 50 , 50);// modified line
When you run this we will have slowly moving cubes. Click on the bottom cube while it is moving (bottom of the screen in the middle) and then click outside so the gizmo will disappear. If you wait until the ‘animation’ stops and try to select the same cube you will only be able to do this if you click where the cube was.
If you look in the code the next line after the above 3 lines is Engine.View=… and Engine.Projection=… .Am I missing something? Thanks in advance
I will have a look at this in the morning :) There could be something wrong with the old ray collision code.
ReplyDeleteI think I've found your bug. (or atleast a bug) This no longer happens in the new beta release (but that is still an early beta with many breaking changes for your integration so the below fix is easier for you now)
ReplyDeleteA quick walkthrough to fix this locally for you:
* Open GizmoComponent.cs
* look for the Update(GameTime gameTime) function.
* move the following lines from update:
this.view = Engine.View;
this.projection = Engine.Projection;
to the very top of the update function, above:
if (!Enabled)
return;
this was causing selection issues where you would use outdated view/projection to select objects.
Thank you Tom,
ReplyDeleteThis is working for me. I appreciate your effort and wish you all the best with the new release. Your Gizmo is really very well designed and I am sure it will benefit the XNA community.
Thank you. Good luck with your editor, make sure you take a look at the new and improved release once it's out of beta ;)
ReplyDeleteHey Tom!
ReplyDeletei'am planing to use your nice 3D gizmos, but dont want to implement stuff when it's allready "outdated".
Any ETA on your new, improved version? Or can you atleast commit your local changes? :)
//christian
Hi! The most recent version of the gizmo is available at http://xnagizmo.codeplex.com/SourceControl/list/changesets I have been so busy with other projects I completely forgot about it. If I can find some time I will look into the current code and make sure a release candidate is published on the codeplex mainpage.
ReplyDeleteIf you have any trouble implementing the code, feel free to contact me.
Your Component is really nice. I will use XNAML to combine it with WPF to create a Level Editor. However there is one bug I encountered and one question left:
ReplyDelete1) Select an arbitrary box and move it around. With local selection the you can do everything find, but using world the world space coordinates fails as one has to select the desired axis around the world origin! This means if I have a box selected and change to World and try e.g. to click the visible x-axis the box is getting deselected!
2) There is currently no camera movement implemented in there - so what tutorials would you suggest to implement so?
Thanks! :) Have a look at the source code tab and download the latest version, this should include some kind of camera movement (it's been a while but I believe I added camera movement in the 2.0 version) otherwise there are several solid resources on how to manipulate your camera, even by downloading some XNA examples such as the billboard example.
DeleteAbout the bug, are you using the 2.0 release from the source tab? If so I will have to take a look, the current 1.0 of the Downloads tab is a bit outdated and will be replaced with the 2.0.
While you haven't replied me yesterday I have experimented a bit and implemented full camera movement with WASD and using the mouse one can pitch in local space and yaw in world space like expected.
DeleteAbout the 2.0 version... i cannot find it, the newest version in codeplex is the commit 72660 from Dec 23 2011, 6:03 PM, which seems a bit outdated, nevertheless I download this one and I have the specified issued with that. After experimenting a bit, it seems that when I select an object and activate World Space it seems like the gizmo is drawn in the object but the actual usable part of it is handled as a World Space pivot :O Can you have a look into this?
I will see what I can do about that issue.
DeleteI've tracked down the issue, you can do a quick diff check or look at the following line:
DeleteInside Function: SelectAxis(Vector2 mousePosition)
if (ActiveMode == GizmoMode.Translate /* removed code here */)
{
}
The above was changed, I removed a statement check for the type of space (don't remember why it was there)
I hope this works for you.
Indeed this one works for me. Meanwhile I would like to my initial comment to be able to ask more questions ;)
DeleteIt's about your test model of the box. I am really new to XNA and therefore a bit confused about how XNA handles models. I have increased the allover size of the GridComponent to 2048 (I will probably scale everything down) and set its spacing to 64, so that I can use 128^3 voxels as the base object for my level geometry. Could you give me some hints or links to articles and tutorials on how to:
1) handle the specific dimension of your box (to force it to 128^3 units)?
2) texturize such models - however by letting me choose one of 6 different textures for each face.
Any tips and help would be appreciated :)
Thanks again for the bugfix!
You'd have to check if this is true, but I believe the sample box is either 1 or 10 "units" in w/h/l. A good approach is to export a box from your modeling app, and set it to 1 generic max units and export it to .fbx. You should from that point on use that box as a reference for other exports.
ReplyDeleteIf you're sticking to boxes, you could create your own array of vertices inside of XNA code. http://www.switchonthecode.com/tutorials/creating-a-textured-box-in-xna (this one is not for XNA 4.0, but should still show you how to create a box shape)
As for the per-face texture you could try different approaches. Create a shader that picks a texture depending on the face normal or create custom draw code that assigns a texture to the shader before drawing (you'd have to apply some optimization tricks if you're going to draw huge scenes using such a method) there are a number of ways to do so, if you're looking for a minecraft type of game - I believe there are a number of people that have worked on code for that in XNA.
I will experiment with your box a little bit as I never was a designer and Blender is just... overwhelming. If I fail working with the model I will try out the hard coded vertices method.
DeleteConcerning the textures, this will be no Minecraft clone. It will be a more simplified version of a proprietary editor I use to map, however the editor I use has way too much options and functions so I cannot really focus on my map I want to create during a brainstorm. Therefore I simplified the concept of the geometry with voxels so one can easily just play Minecraft/Lego for the basic layout and then individually selecting a face to assign a texture to it. nevertheless I will first try to make the cube thing work. Thanks for now!