# Search:

Type: Posts; User: joaquim

1. ## Thread: 3D Math: how draw a 3D cube?

by joaquim
Replies
124
Views
6,978

### Re: 3D Math: how draw a 3D cube?

finally i fixed how i draw the plane:
1 - get all four vectors and rotate them;
2 - i test if the plane is drawed on camera, if not then exit the sub;
3 - else i test the bottoms vectors for...
2. ## Thread: Math 3D: how calculate the camera size?

by joaquim
Replies
0
Views
125

### Math 3D: how calculate the camera size?

my camera size and position seems compatible with my draw positions or ConvertPositon3DTo2D() function...
see my entire code:

Option Explicit

'Get Key state:
Const KEY_DOWN As Integer =...
3. ## Thread: 3D Math: how draw a 3D cube?

by joaquim
Replies
124
Views
6,978

### Re: 3D Math: how draw a 3D cube?

i'm using a timer for use the keyboard
arrow\direction keys and the 'W', 'S', 'A' and 'S'

Option Explicit

'Get Key state:
Const KEY_DOWN As Integer = &H8000
Private Declare Function...
4. ## Thread: 3D Math: how draw a 3D cube?

by joaquim
Replies
124
Views
6,978

### Re: 3D Math: how draw a 3D cube?

passel: the DrawPlane is almost done:

Private Sub DrawPlane(Position As position3D, Size As Size3D, Rotation As Angle3D, WorldSize As Size3D)
Dim Points(4) As POINTAPI

Dim NewPoint...
5. ## Thread: why Polygon() don't use the brush?

by joaquim
Replies
4
Views
469

### Re: why Polygon() don't use the brush?

if i lose the left line(for exemple), because it's outside the camera, the plane isn't drawed.... how can i fix these?
i must draw all lines :(
6. ## Thread: why Polygon() don't use the brush?

by joaquim
Replies
4
Views
469

### Re: why Polygon() don't use the brush?

now works fine:

Private Sub DrawPlane(position As position3D, size As Size3D, Rotation As Angle3D, WorldSize As Size3D, color As ColorConstants)
Dim RotatedPosition As position3D
With...
7. ## Thread: VB6: where is SQRT() and ceiling() functions?

by joaquim
Replies
9
Views
511

### Re: VB6: where is SQRT() and ceiling() functions?

thank you so much for all to all.. thank you
now i will fix my DrawPlane() function... thank you
8. ## Thread: VB6: where is SQRT() and ceiling() functions?

by joaquim
Replies
9
Views
511

### Re: VB6: where is SQRT() and ceiling() functions?

thank you so much for correct me about 'sqr' and 'sqrt'

is these Ceiling function correct:

Private Function Ceiling(MyNum As Double)
If Math.Round(MyNum, 0) < MyNum Then
Ceiling =...
9. ## Thread: how can i walk throw the line?

by joaquim
Replies
3
Views
433

### Re: how can i walk throw the line?

isn't 100% but works fine:

'if the vector is the destiny position, change the parameter order for get the right result... i had tested
Private Function GetInCamVector(Origin As Position3D,...
10. ## Thread: why Polygon() don't use the brush?

by joaquim
Replies
4
Views
469

### why Polygon() don't use the brush?

i change the brush:

Dim oldbrush As Long
oldbrush = GetDCBrushColor(Me.hDC)
SetDCBrushColor Me.hDC, RGB(255, 0, 0)
i call the Polygon() function by double a double vectors(draw 1 line...
11. ## Thread: VB6: where is SQRT() and ceiling() functions?

by joaquim
Replies
9
Views
511

### VB6: where is SQRT() and ceiling() functions?

the Visual Basic 6 don't have the Sqrt() and Ceiling() functions?
the Sqr() isn't Sqrt(), right?
12. ## Thread: how can i walk throw the line?

by joaquim
Replies
3
Views
433

### how can i walk throw the line?

see these image:
https://2.bp.blogspot.com/-STOKeDBaaj8/T4ww1IaPs4I/AAAAAAAAArw/LSRity38nIY/s1600/distanc1.png

i know calculate the AB distance using the Pythagorean theorem.
my question is:...
13. ## Thread: 3D Math: how draw a 3D cube?

by joaquim
Replies
124
Views
6,978

### Re: 3D Math: how draw a 3D cube?

SeabrookStan's: i have 2 questions:
1 - how you get\calculate the line coordinates when the vector it's outside the view\camera?
2 - isn't normal draw the plane using triangles?
14. ## Thread: 3D Math: how draw a 3D cube?

by joaquim
Replies
124
Views
6,978

### Re: 3D Math: how draw a 3D cube?

YES the plane is working fine now:

Private Function IsOnCamera(VerticePosition As Position3D, VerticeSize As Size3D, CameraPosition As Position3D, CameraSize As Size3D) As Boolean
If...
15. ## Thread: how compare and use the last value?

by joaquim
Replies
6
Views
386

### Re: how compare and use the last value?

i'm sorry passel, but see these IsOnCamera() (position is zero and the size is the window size)function:

Private Function IsOnCamera(VerticePosition As Position3D, VerticeSize As Size3D,...
16. ## Thread: how compare and use the last value?

by joaquim
Replies
6
Views
386

### Re: how compare and use the last value?

after several tests now i did it:

Private Function IsOnCamera(VerticePosition As Position3D, VerticeSize As Size3D, CameraPosition As Position3D, CameraSize As Size3D) As Boolean
If...
17. ## Thread: how compare and use the last value?

by joaquim
Replies
6
Views
386

### Re: how compare and use the last value?

If ((NewPosition3D(0).Z) > Camera1.Position.Z) Then
is the collision detection:

Private Function IsCollisionVertice3D(Vertice1 As Position3D, ObjectPosition2 As Position3D,...
18. ## Thread: how compare and use the last value?

by joaquim
Replies
6
Views
386

### Re: how compare and use the last value?

i'm sorry but i need ask: when i use the rotation, these 'if' works on same way or i must adapt the angle?
(yes i have notice the draw bug)
19. ## Thread: how compare and use the last value?

by joaquim
Replies
6
Views
386

### Re: how compare and use the last value?

thank you so much for all

Private Sub DrawLine(Position As Position3D, Size As Size3D, Rotation As Angle3D, WorldSize As Size3D)
Dim Points(2) As POINTAPI
Dim NewPoint(2) As POINTAPI
...
20. ## Thread: how compare and use the last value?

by joaquim
Replies
6
Views
386

### how compare and use the last value?

i have a variable NewPosition3D(0) it's Position3D type.
when the NewPosition3D(0).z is more big than camera.z, the NewPosition3D(0) must be the last position... so i did:

If...
21. ## Thread: 3D Math: how draw a 3D cube?

by joaquim
Replies
124
Views
6,978

### Re: 3D Math: how draw a 3D cube?

passel i'm trying do what i can and know... but i only get that problem only when the Z is negative...
i belive the same goes to X and Y... but, for now, i fixed the Z:

Private Sub...
22. ## Thread: 3D Math: how draw a 3D cube?

by joaquim
Replies
124
Views
6,978

### Re: 3D Math: how draw a 3D cube?

finally i get something:
1 - i test if the point is on camera view;
2 - if is, then draw it;
3 - if isn't, then with player direction and position i get the line position:

Private Function...
23. ## Thread: [RESOLVED] how can i test a number if is valid?

by joaquim
Replies
18
Views
378

### Re: [RESOLVED] how can i test a number if is valid?

thank you Eduardo i never knew about it.. thank you
24. ## Thread: [RESOLVED] how can i test a number if is valid?

by joaquim
Replies
18
Views
378

### Re: [RESOLVED] how can i test a number if is valid?

the best is change these:

Private Function GetLinePosition(Origin As Position3D, Destiny As Position3D, FromActual As Position3D) As Position3D
to these:

Private Function...
25. ## Thread: [RESOLVED] how can i test a number if is valid?

by joaquim
Replies
18
Views
378

### Re: how can i test a number if is valid?

thank you so much for correct me...
thank you to all for all.. thank you
26. ## Thread: [RESOLVED] how can i test a number if is valid?

by joaquim
Replies
18
Views
378

### Re: how can i test a number if is valid?

Private Type Position3D
X As Double
Y As Double
Z As Double
End Type
it's double
27. ## Thread: [RESOLVED] how can i test a number if is valid?

by joaquim
Replies
18
Views
378

### Re: how can i test a number if is valid?

1st i'm so sorry if my question is confused:
see these sample:

FromActual.X=nothing
'...............
if(FromActual.X!=nothing) then
'do something
end if
same for others...
28. ## Thread: [RESOLVED] how can i test a number if is valid?

by joaquim
Replies
18
Views
378

### Re: how can i test a number if is valid?

i need use FromActual.X or FromActual.Y or FromActual.Z, it depends on their values...
- if 'Z' have a value, i must ignore the others;
- if 'X' have a value, i must ignore the others;
- if 'Y'...
29. ## Thread: [RESOLVED] how can i test a number if is valid?

by joaquim
Replies
18
Views
378

### Re: how can i test a number if is valid?

"Do you want to see if a 'number' is a number?"
yes...
if i do:

FromActual.Z=nothing
is the same of zero?
30. ## Thread: [RESOLVED] how can i test a number if is valid?

by joaquim
Replies
18
Views
378

### Re: how can i test a number if is valid?

Private Function GetLinePosition(Origin As Position3D, Destiny As Position3D, FromActual As Position3D) As Position3D
by deafult the FromActual.X, FromActual.Y, FromActual.Z are zero... but i only...
31. ## Thread: [RESOLVED] how can i test a number if is valid?

by joaquim
Replies
18
Views
378

### [RESOLVED] how can i test a number if is valid?

ok... the variable integer can get zero, positive and negative... until here fine...
imagine that 1 function\sub parameter is a type with X,Y,Z members.... and i only need use 1 of that members...
32. ## Thread: 3D Math: how draw a 3D cube?

by joaquim
Replies
124
Views
6,978

### Re: 3D Math: how draw a 3D cube?

finally i'm doing something:

Private Function IsCollision3D(ObjectPosition1 As Position3D, ObjectSize1 As Size3D, ObjectPosition2 As Position3D, ObjectSize2 As Size3D)
IsCollision3D =...
33. ## Thread: 3D Math: how draw a 3D cube?

by joaquim
Replies
124
Views
6,978

### Re: 3D Math: how draw a 3D cube?

i still confused with 1 thing: i think the avoid draw everything is for don't use severy the CPU... that i understand... so what i'm asking!?!
that code works fine but something don't make sence to...
34. ## Thread: 3D Math: how draw a 3D cube?

by joaquim
Replies
124
Views
6,978

### Re: 3D Math: how draw a 3D cube?

i have the 3D collision function:

Private Function IsCollission3D(ObjectPosition1 As Position3D, ObjectSize1 As Size3D, ObjectPosition2 As Position3D, ObjectSize2 As Size3D)
IsCollission3D =...
35. ## Thread: 3D Math: how draw a 3D cube?

by joaquim
Replies
124
Views
6,978

### Re: 3D Math: how draw a 3D cube?

now i have seen how you work with camera... on rotation, you use:
1 - the rotation camera position;
2 - you add the camera position after rotate the vertice.

i need ask more 2 things:
1 - is my...
36. ## Thread: 3D Math: how draw a 3D cube?

by joaquim
Replies
124
Views
6,978

### Re: 3D Math: how draw a 3D cube?

maybe thinking on these way:
1 - testing the 3D collision between the vertice and the camera view;
2 - testing if the next vertice is inside de view for we change the distance between the 2...
37. ## Thread: 3D Math: how draw a 3D cube?

by joaquim
Replies
124
Views
6,978

### Re: 3D Math: how draw a 3D cube?

you don't belive: now works... i just change the speed:

Private Sub Timer1_Timer()
Const Speed As Integer = 20
If KeyState(vbKeyA) = True Then
Angletest.Y = Angletest.Y + 1
...
38. ## Thread: [RESOLVED] VB6 - how use keys with controls?

by joaquim
Replies
7
Views
362

### Re: [RESOLVED] VB6 - how use keys with controls?

'Get Key state:
Const KEY_DOWN As Integer = &H8000
Private Declare Function GetKeyState Lib "user32.dll" (ByVal nVirtKey As KeyCodeConstants) As Integer

Private Function KeyState(ByVal nVirtKey...
39. ## Thread: 3D Math: how draw a 3D cube?

by joaquim
Replies
124
Views
6,978

### Re: 3D Math: how draw a 3D cube?

i'm using the timer without success :(

Private Sub Timer1_Timer()
Const Speed As Integer = 1
If GetKeyState(vbKeyA) And KEY_DOWN Then
Angletest.Y = Angletest.Y + 1
...
40. ## Thread: [RESOLVED] VB6: how initialize variables?

by joaquim
Replies
7
Views
245

### Re: VB6: how initialize variables?

thank you so much for correct me... thank you
Results 1 to 40 of 500