Skip to main content
gamedev.net
🔒 Locked

D3D8, VB6

Started by Fear 4 replies 750+ views
Original Post
Fear
Fear
Ok, I'm using DX8 in VB6. I have my 3D model all loaded on, yet, I can't pinpoint a specific spot on it. What I mean is, imagine a fighter plane, with a machine gun. How would you load the particle effect to be exactly where the machine gun is, no matter what way the plane is facing. Thank you for your time.
~Fear~
jollyjeffers
jollyjeffers
Well there isn't really a Direct3D-specific way of doing this. You'll need to acquire some information from your loaded mesh - vertex positions and so on, but after that it becomes a regular graphics algorithm.

A number of solutions I've read about involve some form of "tagging" in the editor - adding in primitives with special properties that don't get rendered, but act as placeholders for the engine code to work with. For example, you (or your artist) could add an invisible object with a particular ID at the end of the gun, and your engine emits particles from that position.

hth
Jack
<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ |
Fear
Fear
Another question, relating to the same problem (sort of). How do you move an object through 3D space. Mine can rotate, but no movement.
~Fear~
Jacob Roman
Jacob Roman
Use D3DXMatrixTranslation. I have these functions I made to help simplify things, but be sure you reset the world matrix for every other object you want to do this to. Otherwise it'll end up doing it to the other objects you don't want moved or rotated:

Public Sub Rotate_Local_Coordinates(ByVal Angle_X As Single, ByVal Angle_Y As Single, ByVal Angle_Z As Single)    D3DXMatrixRotationX Rotate_X_Matrix, (PI * Angle_X) / 180    D3DXMatrixMultiply World_Transformation_Matrix, World_Transformation_Matrix, Rotate_X_Matrix        D3DXMatrixRotationY Rotate_Y_Matrix, (PI * Angle_Y) / 180    D3DXMatrixMultiply World_Transformation_Matrix, World_Transformation_Matrix, Rotate_Y_Matrix        D3DXMatrixRotationZ Rotate_Z_Matrix, (PI * Angle_Z) / 180    D3DXMatrixMultiply World_Transformation_Matrix, World_Transformation_Matrix, Rotate_Z_Matrix        Direct3D_Device.SetTransform D3DTS_WORLD, World_Transformation_Matrix    End SubPublic Sub Translate_Local_Coordinates(ByVal Translate_X As Single, ByVal Translate_Y As Single, ByVal Translate_Z As Single)        D3DXMatrixTranslation Translation_Matrix, Translate_X, Translate_Y, Translate_Z    D3DXMatrixMultiply World_Transformation_Matrix, World_Transformation_Matrix, Translation_Matrix    Direct3D_Device.SetTransform D3DTS_WORLD, World_Transformation_MatrixEnd SubPublic Sub Scale_Local_Coordinates(ByVal X As Single, ByVal Y As Single, ByVal Z As Single)    D3DXMatrixScaling World_Transformation_Matrix, X, Y, Z    Direct3D_Device.SetTransform D3DTS_WORLD, World_Transformation_Matrix    End Sub
Fear
Fear
Can you explain this too me, I'm still fairly new in D3D8, and am having troubles with understanding. If I did understand, I could figure out how to implement the movement into my game.
~Fear~
Jacob Roman
Jacob Roman
All I did was simplify rotation, translation, and scaling to make it easier for ya. Incase you didn't know, translation is movement, and scaling is sizing your polygons by multiplying it by a scale factor.

Now like I said earlier, you use these lines of code for every polygonal object in the rendering loop.

D3DXMatrixIdentity World_Transformation_MatrixScale_Local_Coordinates 1, 1, 1Rotate_Local_Coordinates 0, 0, 0Translate_Local_Coordinates 0, 0, 0

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.