Making a navigation 3D cube - c#

I'm trying to make a 3D cube in Microsoft Visual Studio, and what I'm trying to get it to do is let you drag it around with your mouse.
(Ex. Grab the cube with left click and holding and then dragging around your screen to rotate it 3D)
is this possible to do with c#?

This is easy to implement in WPF Introduction to WPF 3D and using Behaviors for making it drag-able

You can use transformation in WPF, or use opengl in C#, see this post.

Related

Drawing a circle in Unity and C#

I have this project that I'm re-doing on Unity after I've implemented it on Android Studio's Java. One component that's part of the UI is a big circle that should be clickable and should display the coordinates of the clicked location on the circle alone.
I'm having a hard time re-implementing this in C# and unity; in Java, this could be simple done by extending the View class and using Path and Canvas to draw the circle. Are there any similar functions in C# and Unity? If not, how can this be done?

How to implement rigid body dynamics previewed by WPF 3D

I'm currently facing a problem with WPF 3D using C#. To put it simple, I need to animate some simple mechanical part by only moving two of them (one at a time or both together). Here is a simple drawing depicting the situation :
So by moving (translating) vertically P1 or/and P2 parts, the whole thing needs to move accordingly.
I guess it may be possible to do by computing a lot of angles and applying numerous transformations but this is not my goal.
Therefore I would imagine something like attaching the parts together by the means of a pivot point.
What is the preferred way to do this to preview it using WPF 3D?
WPF 3D, Ogre, Mogre, OpenTK... are libraries for display. They have nothing to do with mechanical constraints calculations. But they goes well with physics engines.
WPF 3D is a subset of WPF dedicated to 3D drawing. If you need 2D, then WPF is enough.
As your project looks 2D, you might want to have a look to Farseer Physics which is a port of Box 2D. The feature you need is called joints. Both libraries target 2D games development, but they can be used for simple kinematics animations, and Farseer Physics is doing very well with WPF.
It's a simple problem for any 2D kinematics package.
http://books.google.com/books?id=IGtIWmM2GWIC&pg=PR12&lpg=PR12&dq=c%23+kinematics&source=bl&ots=eCJZLq_i6R&sig=wC42cNOdtw4VX9ElTk4IBDAYtzc&hl=en&sa=X&ei=3YkXU4u1EeHu2wXum4GYDA&ved=0CFsQ6AEwBQ#v=onepage&q=c%23%20kinematics&f=false

is there a way to make a 3D game in winforms or WPF in C#?

I'm thinking about making a 3D point and click game, is it possible to make one in winforms or WPF? I don't need any physics or anything all I need is to make the application render 3D objects. I know that I can use XNA but if I do then I will have to relearn almost everything again. My third approach would be to make the scenes in a 3D game engine and then print the screen and then load it as a image. Any suggestion would be appreciated.
There's a big difference between a 3D game, and just letting players interact with a rendered image.
Your approach of loading a pre-rendered image is possible to do in both Winforms and WPF. You would just need to capture click events on the image and check the location against your list of active areas. Then just handle what needed to be done, ie: move to the next area, activate item, etc.
Edit from comment:
It's not so much which is friendlier. You can host an XNA viewport in Winforms/WPF. It's more about how you want your game to work. If you never have moving 3D scenes, XNA is overkill, and images will work just fine.
If you want dynamic scenes, you'll need to be able to render them on the fly. Then, XNA makes more sense. It is a lot more work though compared to just displaying images.
If you just want to show pre-rendered 3d images in your game, why not create them using a real 3d graphics tool, such as 3D Studio Max or Maya (or a free one, such as Blender)? It sounds like there's no need for actually rendering the 3d scenes in a game engine at all.

Roulette Wheel C#

I'd like to create a game with some kind of a Roulette Wheel with C#.
I have no relevant experience in GUI.
The first thing that comes to my mind when I want to develop such Roulette Wheel, is silver light but I prefer to implement it in a winform (unless you think otherwise).
If you can give me some ideas were to start...
1. How can I create the wheel
2. How can I make the ball go over it (don't want 3D grapics with bouncing and other fantastic ideas)
And please, as simple and basic as possible
Thanks
Asaf
Microsoft released a great framework for 2D and 3D game developemnt - XNA. You can easily add sounds and keyboard events to your game. There is also possibility to put your game onto a windows Forms. Here is a blog post about this by Roy Triesscheijn:
http://royalexander.wordpress.com/2008/10/09/xna-30-and-winforms-the-easy-way/
I've learned XNA 2D basics in one day so you shuld check it out.
Check out also this tutorial, it's really nice and for absolute beginner:
http://creators.xna.com/en-US/education/gettingstarted/bg2d/chapter1
Windows Forms has this amazing feature called nonrectangular forms wherein you can create "shaped" forms like polygons etc. Perhaps that can help you create the wheel.
http://msdn.microsoft.com/en-us/library/6k15y9et.aspx
Child controls placed on that form can act like the wedges on the wedges. Again, these "child controls" themselves could be nonrectangular forms.
I think it would be way easier if you opt for WPF for this instead of Winforms. WPF offers a wide range of controls and features that seem tailormade for such applications.
You can create a gif of a spinning wheel the slowly slows down. Then you can plot the known relative co-ordinates of each of the balls finishing positions.
For example 00 might be at the top when the animation has finished. In your page generate a random number (pseduo random is fine for a roulette wheel where no real money is being staked!), and have a ball gif. Use javascript to 'spin' the ball in the opposite direction of the wheel gif and slowly come to a stop the same time as the wheel animation, finishing at your plotted known co-ordinates.
Hope this gives you some ideas. There are several ways to do this!

Spinning a 3D model in C#

How do I take a 3D model that I created in 3D Studio Max and put it into my Winform C# program and make it spin? I'd prefer not to use DirectX if possible. I don't want anything complex. I simply want my model to rotate along the X axis. Thats it.
Thanks
You should use a 3D rendering engine for C#
Something like
http://axiom3d.net/wiki/index.php/Main_Page
http://www.codeproject.com/KB/GDI-plus/exoengine.aspx
http://irrlicht.sourceforge.net/features.html
http://freegamedev.net/wiki/Free,_cross-platform,_real-time_3D_engines
I have never used any rendering engines but for your requirements (letting the user move the object) i think a 3D engine would do. But perhaps this is over kill
If you want it to be dynamic, then the simplest option would be to render out an animation of the object rotating, but make each frame a separate file. Then you just show the correct image based on how the user is dragging the mouse. If the user drags the mouse to the right, then increment the frame and show the next image. If moving to the left, decrement the frame.
For something non interactive:
Export the animation to an AVI and embed that in your form:
Embedding Video in a WinForms app
It's not really what I'd recommend, but it's an alternative to creating an animated gif.
For something partially interactive (i.e. allowing limited movement):
I've seen QuickTime movies that you can control with the mouse. There's an example on this page. It's not 3D though.
For something fully interactive:
You need a 3D rendering engine of some sort and that does (usually) require DirectX or OpenGL. However, if you're only dealing with simple objects you might (repeat might) get away with a software renderer.

Categories

Resources