When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
well....i didnt get it to work...maybe if i play around alot with it, but there must be someone that has a formula for calculating it.
i went to www.howstuffworks.com and looked it up, but they didnt give me all of the formula...they just said something like this: "now you see how much calculations there is in a 3d scene", then i replied for myself "I DONT CARE! I WANT TO KNOW HOW!" hehe...im getting crazy searching for this! i dont know what to search for. i search for "3d math" and get alot of irrelevant stuff! damn...
192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
Posts
3,051
What type of 3D are you trying to create? Perspective, isometric....
Also, won't you need a position vector and an angle vector of the camera?
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
BTW, i searched for "3d position 2d plane" on incase you're wondering (without the quotes).
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
I'll post a pic to tell you what the things all stand for...
(just got to draw it first)
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
The formula tells you the 3D position on the screen plane(its 3D because if you tilt the camera up it will need the screen plane to work in 3D) that the vector intercepts it. I'll get on to writing something now to change this 3D position into a 2D point on the screen.
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
Posts
3,051
Re: Please help!
Originally posted by cyborg If you're good at these stuff...please also tell me how to work with vectors!
What sort of stuff do you want to know?
Vectors are pretty simple really.
A vector has 3 values, for positions & offsets (velocity) they're usually called x,y and z, for a direction vector you may call them something else (Pitch, Yaw & Roll for instance).
To add them, simply add the x, y and z calues with another vectors x,y and z values respectivly.
The opposite of a vector is simply (-x,-y,-z)
Another thing you'll probably need to know is how to normalize a vector.
This means, given a velocity vector (most common use), make it so that the speed is exactly 1, but the direction remains the same.
Anything else?
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
Posts
3,051
Originally posted by Electroman Hehe, didn't realise the pics were so big, soz
Let's hope cyborg isn't a 56ker.
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
I'm using a 56K at the moment and it didn't take that long(mind the images are less than 100KB each) jpegs are doing some wicked compression, A??
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
Posts
3,051
BTW, on the first page, shouldn't that 'b' be a 'c', if not where did it come from?
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
Posts
3,051
Re: Re: Re: Please help!
Originally posted by cyborg I really want to use vectors! so i can move and rotate the camera! that would be nice...
If you want to do that then your camera would have to have to vetors associated with it. One that was it's position, and one that was the direction it's facing.
To make it move, you'd also want a veolcity vector.
Making the camera move, would simply be camera.positionvector + camera.Velocityvector.
The direction vector would have to be somehow incorperated into the 'graphics engine' (the system to draw your 3D stuf on a 2D screen).
I'll try to write a little module with some common vector functions for you.
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
SLH: hehe, yea I noticed it just after posting the third page(my bad), it was cos instead of "c" I was using "b" then I changed my mine because "c" for camera, and I wanted to use "B" latter on .
You'd think the letter "b" in nearly 2cm high text i'd of noticed it .
I've nearly got the whole last bit done, wooohooo!!!!!
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
By 2D plane am I write in assuming you mean Screen coordinates??
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
Posts
3,051
Originally posted by cyborg That woul be really nice!
The main problem i have is to write the functons that converts from 3d to a 2d plane...
Did you take a look at the links i suggested?
Below is a few vector functions, they are quite low level, but more powerfull functions could easily be built on top of them.
VB Code:
Type TVector
X As Single
Y As Single
Z As Single
End Type
Public Function VAdd(V1 As TVector, V2 As TVector) As TVector
VAdd.X = V1.X + V2.X
VAdd.Y = V1.Y + V2.Y
VAdd.Z = V1.Z + V2.Z
End Function
Public Function VNormalize(V As TVector, Optional Length As Single = 1) As TVector
Dim Mag As Single
Mag = VMagnitude(V)
VNormalize.X = V.X * Length / Mag
VNormalize.Y = V.Y * Length / Mag
VNormalize.Z = V.Z * Length / Mag
End Function
Public Function VEqual(V1 As TVector, V2 As TVector) As Boolean
VEqual = V1.X = V2.X And V1.Y = V2.Y And V1.Z = V2.Z
End Function
Public Function VMagnitude(V As TVector) As Single
VMagnitude = Sqr(V.X ^ 2 + V.Y ^ 2 + V.Z ^ 2)
End Function
Public Function VScale(V As TVector, Factor As Single) As TVector
VScale.X = V.X * Factor
VScale.Y = V.Y * Factor
VScale.Z = V.Z * Factor
End Function
Public Function VDotProduct(V1 As TVector, V2 As TVector) As TVector
VDotProduct.X = V1.X * V2.X
VDotProduct.X = V1.Y * V2.Y
VDotProduct.X = V1.Z * V2.Z
End Function
Public Function VIsZero(V As TVector) As Boolean
VIsZero = V.X = 0 And V.Y = 0 And V.Z = 0
End Function
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Public Function VCrossProduct(V1 As TVector, V2 As TVector) As TVector
'Direction of VCrossProduct(V1,V2) is perpendicular to plane with vectors V1 and V2 on it,
'magnitude is VMagnitude(V1)*VMagnitude(V2)
VCrossProduct.X = V1.Y * V2.Z - V2.Y * V1.Z
VCrossProduct.Y = V1.Z * V2.X - V2.Z * V1.X
VCrossProduct.Z = V1.X * V2.Y - V2.X * V1.Y
End Function
The easiest way to think about the norm. function is by example.
If the vector V was a velocity vector. Then it's magnitude is it's speed (how fast it's moving, ignoreing direction).
If you want the speed to be reduced to 1, but keep the object moving in the same direction, you'd normalize it's velocity vector.
Hope that was an adiquate explanation.
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
Posts
3,051
I'll see what i can do with the 3D stuff now....
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
i gtg soon, but i'll keep puzzling over it until i do.
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
'These OffSet values are from the center of the screen
I'm goging to write a class to hold all this because these a lot of these things that will only change if the camera is adjusted so a Class could handle it very easily.
Another diagram to describe the new stuff:
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
Check out the files attached, I used a couple of your vector functions SLH to keep the codeshort in the class.
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
Posts
3,051
Originally posted by Electroman I used a couple of your vector functions SLH to keep the codeshort in the class.
Glad they helped.
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
I cant get the class file to work...I get all kinds of error messages about the UTS's and functions..like this one for example:
"Only public user defined types defined in public object modules can be used as parameters or return types for public procedures of class modules or as fields of public user defined types"
try just throwing it into a normal code module then because I got that error and just had to use it sepratly, I don't get the error becasue I did decalare the "Type" in a public module
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
You'll also need to change the params to ByRef cos there user-defined type, opps.
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
ByRef is instead of ByVal, When you use ByVal only the Value of the parameter is sent to the sub, but when you use ByRef a pointer is sent that points to the variable that you used as a parameter so if in the sub the parameter is edited the variable you gave the procedure will also be edited. I'm sure someone could give you a better definition, I can't say what I mean if you get me??
Try this example project, I can't seem to get it to work perfectly but it does display the points, just there all together:
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
I spoke too soon, change the FOV to about half what I set it to and move the cam pos to:
VB Code:
CamPos.X = 50
CamPos.Y = 50
CamPos.Z = 50
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
heres what I have now, I found a typo in the ConvertVetor Procedure and I've fixed that, apart from that theres seems to be something up with the X and Z axis if the camera is set so LookAt.X = LookAt.Y I'm trying to fix that now but can't be sure if its actually just perspective?? Anyway take a look at the attachment, I also fixed a problem that caused the screen to be upside down, in my diagrams the vector u should be the oposite way round, my bad. I feel victory near.
When your thread has been resolved please edit the original post in the thread ()
and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.
yes, you're probably really close. i cant check anything right now cus the whole family is here visiting so i must be with them all the time. Lots of small kids