I need help

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
Craigspaz
Posts: 33
Joined: June 9th, 2012, 12:23 am

I need help

Post by Craigspaz » August 31st, 2012, 1:37 am

In the project attached I made a cube. I am trying to get the cube to spin but I am not sure what code should be used to get the cube to rotate. I used the drawline function to make the cube.
I added my other project were the cube moves but it does not rotate.
Attachments
CubeTest2.zip
The cube moves but wont rotate
(439.76 KiB) Downloaded 166 times
CubeTest.zip
(424.46 KiB) Downloaded 183 times
CraigSpaz

User avatar
Ozi_Juggalo
Posts: 23
Joined: October 2nd, 2012, 3:00 am
Location: Australia

Re: I need help

Post by Ozi_Juggalo » October 29th, 2012, 2:01 pm

Have u tried finding (or creating) a SpriteSheet?
maybe worth lookin into
though if you can get it to spin without sprites, than i take my hat off 2 you
☺☻☻☺!Whoop Whoop MCL!☺☻☻☺

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: I need help

Post by chili » October 31st, 2012, 2:54 pm

You can do it with drawline. You need math. Lots and lots of math. And you need more than just x and y. You need a z in that mofro.
Chili

Paradox
Posts: 22
Joined: July 14th, 2012, 4:11 pm

Re: I need help

Post by Paradox » November 26th, 2012, 3:11 am

Chili, will you be covering that sort of trig in the tutorials? But I would assume that there are already functions for this in DirectX3D though, I just don't know how to use them.

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: I need help

Post by chili » November 27th, 2012, 1:37 pm

Yup, I will be covering all of that. And yup, the D3DX utility library contains a bunch of funcitons for setting up transformation matrices and other useful math stuff.
Chili

adabo
Posts: 154
Joined: October 27th, 2012, 3:28 am
Location: Houston, Texas

Re: I need help

Post by adabo » November 28th, 2012, 4:13 am

chili wrote:... transformation matrices and other useful math stuff.
I passed out reading that. After I'm done with the beginner tuts, I'm going to be taking a long break and will try to learn some math beyond junior-high level. If only the teachers taught math using video games...

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: I need help

Post by LuX » November 28th, 2012, 2:00 pm

I don't think transforming matrices is that hard. After you get the idea of it, it's just series of multiplication and some simple geometry put together. But dunno what chili has in store for us.
ʕ •ᴥ•ʔ

User avatar
codinitup
Posts: 112
Joined: June 27th, 2012, 7:43 am

Re: I need help

Post by codinitup » December 1st, 2012, 6:22 am

Well you said that you are trying to rotate the cube, so I kinda have a solution. In all, yes ALL, 3D game engines such as Unity there are things called matrices (Matrix pl.), and those hold things like transformation, rotation etc... but I was using a thing called XNA ( a framework for C# ) and I was trying to get a good 3D game going and had to use matrices. They are pretty easy to use with some simple playing around and getting used to them. But the real reason you use them is to make sure that your 3D image is going to be drawn to the screen in a 2.5D kind of way. There is no "true" 3D program because that would mean that you can actually see depth. The depth is just an optical illusion if you will. So when the image is drawn to the 2.5D (having 3D appearance), the matrices will then control things like rotation (what part of your 3D object is shown at the time) and make sure that it is drawn correctly. So I guess my point of telling you all that is that there is a function inside of C# that's called MathHelper, and it has all of these nice things in it that allow the computer to take care of most of the math. With that being said you may want to go to Micrsoft's website and check it out. Even though it is in C# if you have any basic knowledge of C++ than you can look at it and have a clue of what's going on. So just look at the MathHelper function and maybe you can imitate some of the math that is going on in there and you can maybe get a rotation going on. I can't help you with much of the math though, as I am only a freshman in Highschool and currently in Geometry, so I can't really recommend what knowledge of math you need to know either. But if I had to guess I would say at least some basic Trigonometry, and probably some basic algebra too.
Good luck bro ;)

EDIT: I just realized that it would also be a good idea for you to understand a Vector2 and a Vector3. They are variables that hold an X and a Y (Vector2), and hold X,Y, and Z coordinates (Vector3). I would make sure that you try to rework the put pixel function to try to use those too because then you can imitate almost exactly what is going on in the MathHelper function. MathHelper and almost every single 3D object will make EXTENSIVE use of Vector3's, mostly because I guess they are more organised in a way. I don't know if the framework is optimized for a 3D image yet so I would also look into some of the ways to optimize DirectX9 to work with 3D objects... I also said that you need some knowledge of Trig too, well that is true. I said that because every shape in 3D space is drawn with Triangles, so having a good knowledge of trig is good when you are working with a game engine, or your own code, to get things to rotate or move when there aren't any functions to do it for you...So with all of these tips I would recommend starting with getting the framework going with 3D, and then maybe you can use some vector3's and matrices (along with the math from MathHelper) to start drawing some 3D images. Then you can work on the Rotation of the object.
MOOOOOO

Post Reply