Moving mesh? 
Author Message
 Moving mesh?

I have the code below and when I moved around in the
3D environment I my .X object that's been put into
the scene moves along the X and Z axis, why?

If I move up,down or left,right it will move slightly
in the opposite direction I'm moving.

Wierd no?

Thanks,
Adam

' Adds a File .X to any position in the scene
' XFile = filename of the mesh
' Scale = the scale of the mesh
' X = the X coord where it will be placed
' Y = the Y coord where it will be placed
' Z = the Z coord where it will be placed
Public Sub AddMesh(XFile As String, MeshScale As Single, X As Single, y As
Single, Z As Single)

  Dim FR_Mesh As Direct3DRMFrame3 ' The Mesh frame
  Dim MS_Mesh As Direct3DRMMeshBuilder3 ' The MeshBuilder

  Set FR_Mesh = D3D_Main.CreateFrame(FR_Root)  ' Lets create the frame
(under the FR_Root in the "tree")
  Set MS_Mesh = D3D_Main.CreateMeshBuilder() ' Lets create our meshbuilder

  MS_Mesh.LoadFromFile XFile, 0, 0, Nothing, Nothing    ' Load the file .X

  MS_Mesh.ScaleMesh MeshScale, MeshScale, MeshScale ' Set the scale

  FR_Mesh.SetPosition Nothing, X, y, Z ' Set the position
  FR_Mesh.AddVisual MS_Mesh  ' Add the mesh to its frame

End Sub



Mon, 26 Sep 2005 02:58:53 GMT  
 Moving mesh?
it sounds like the x,y,z of where the object is positioned is being modified
when you move the camera.


Quote:
> I have the code below and when I moved around in the
> 3D environment I my .X object that's been put into
> the scene moves along the X and Z axis, why?

> If I move up,down or left,right it will move slightly
> in the opposite direction I'm moving.

> Wierd no?

> Thanks,
> Adam

> ' Adds a File .X to any position in the scene
> ' XFile = filename of the mesh
> ' Scale = the scale of the mesh
> ' X = the X coord where it will be placed
> ' Y = the Y coord where it will be placed
> ' Z = the Z coord where it will be placed
> Public Sub AddMesh(XFile As String, MeshScale As Single, X As Single, y As
> Single, Z As Single)

>   Dim FR_Mesh As Direct3DRMFrame3 ' The Mesh frame
>   Dim MS_Mesh As Direct3DRMMeshBuilder3 ' The MeshBuilder

>   Set FR_Mesh = D3D_Main.CreateFrame(FR_Root)  ' Lets create the frame
> (under the FR_Root in the "tree")
>   Set MS_Mesh = D3D_Main.CreateMeshBuilder() ' Lets create our meshbuilder

>   MS_Mesh.LoadFromFile XFile, 0, 0, Nothing, Nothing    ' Load the file .X

>   MS_Mesh.ScaleMesh MeshScale, MeshScale, MeshScale ' Set the scale

>   FR_Mesh.SetPosition Nothing, X, y, Z ' Set the position
>   FR_Mesh.AddVisual MS_Mesh  ' Add the mesh to its frame

> End Sub



Mon, 26 Sep 2005 06:22:45 GMT  
 Moving mesh?
Right but why?

 'Move forwards
  If DI_State.Key(DIK_UP) <> 0 Then
    If DI_State.Key(DIK_LSHIFT) <> 0 Or DI_State.Key(DIK_RSHIFT) <> 0 Then
      FR_Camera.SetPosition FR_Camera, 0, 0, RunSpeed  ' (Run) Move the
viewport forward
    Else
      FR_Camera.SetPosition FR_Camera, 0, 0, WalkSpeed ' (Walk) Move the
viewport forward
    End If
  End If

  'Move backwards
  If DI_State.Key(DIK_DOWN) <> 0 Then
    FR_Camera.SetPosition FR_Camera, 0, 0, WalkSpeed2  ' Move the ViewPort
back
  End If

Adam



Quote:
> it sounds like the x,y,z of where the object is positioned is being
modified
> when you move the camera.



> > I have the code below and when I moved around in the
> > 3D environment I my .X object that's been put into
> > the scene moves along the X and Z axis, why?

> > If I move up,down or left,right it will move slightly
> > in the opposite direction I'm moving.

> > Wierd no?

> > Thanks,
> > Adam

> > ' Adds a File .X to any position in the scene
> > ' XFile = filename of the mesh
> > ' Scale = the scale of the mesh
> > ' X = the X coord where it will be placed
> > ' Y = the Y coord where it will be placed
> > ' Z = the Z coord where it will be placed
> > Public Sub AddMesh(XFile As String, MeshScale As Single, X As Single, y
As
> > Single, Z As Single)

> >   Dim FR_Mesh As Direct3DRMFrame3 ' The Mesh frame
> >   Dim MS_Mesh As Direct3DRMMeshBuilder3 ' The MeshBuilder

> >   Set FR_Mesh = D3D_Main.CreateFrame(FR_Root)  ' Lets create the frame
> > (under the FR_Root in the "tree")
> >   Set MS_Mesh = D3D_Main.CreateMeshBuilder() ' Lets create our
meshbuilder

> >   MS_Mesh.LoadFromFile XFile, 0, 0, Nothing, Nothing    ' Load the file
.X

> >   MS_Mesh.ScaleMesh MeshScale, MeshScale, MeshScale ' Set the scale

> >   FR_Mesh.SetPosition Nothing, X, y, Z ' Set the position
> >   FR_Mesh.AddVisual MS_Mesh  ' Add the mesh to its frame

> > End Sub



Mon, 26 Sep 2005 06:50:36 GMT  
 Moving mesh?
this sounds like an app problem, requiring standard debugging skills, and
not DirectX related.

fwiw, RM is "old" technology, based on DX6, is not actively worked on, will
never be updated, and thus is obsolete.


Quote:
> Right but why?

>  'Move forwards
>   If DI_State.Key(DIK_UP) <> 0 Then
>     If DI_State.Key(DIK_LSHIFT) <> 0 Or DI_State.Key(DIK_RSHIFT) <> 0 Then
>       FR_Camera.SetPosition FR_Camera, 0, 0, RunSpeed  ' (Run) Move the
> viewport forward
>     Else
>       FR_Camera.SetPosition FR_Camera, 0, 0, WalkSpeed ' (Walk) Move the
> viewport forward
>     End If
>   End If

>   'Move backwards
>   If DI_State.Key(DIK_DOWN) <> 0 Then
>     FR_Camera.SetPosition FR_Camera, 0, 0, WalkSpeed2  ' Move the ViewPort
> back
>   End If

> Adam



> > it sounds like the x,y,z of where the object is positioned is being
> modified
> > when you move the camera.



> > > I have the code below and when I moved around in the
> > > 3D environment I my .X object that's been put into
> > > the scene moves along the X and Z axis, why?

> > > If I move up,down or left,right it will move slightly
> > > in the opposite direction I'm moving.

> > > Wierd no?

> > > Thanks,
> > > Adam

> > > ' Adds a File .X to any position in the scene
> > > ' XFile = filename of the mesh
> > > ' Scale = the scale of the mesh
> > > ' X = the X coord where it will be placed
> > > ' Y = the Y coord where it will be placed
> > > ' Z = the Z coord where it will be placed
> > > Public Sub AddMesh(XFile As String, MeshScale As Single, X As Single,
y
> As
> > > Single, Z As Single)

> > >   Dim FR_Mesh As Direct3DRMFrame3 ' The Mesh frame
> > >   Dim MS_Mesh As Direct3DRMMeshBuilder3 ' The MeshBuilder

> > >   Set FR_Mesh = D3D_Main.CreateFrame(FR_Root)  ' Lets create the frame
> > > (under the FR_Root in the "tree")
> > >   Set MS_Mesh = D3D_Main.CreateMeshBuilder() ' Lets create our
> meshbuilder

> > >   MS_Mesh.LoadFromFile XFile, 0, 0, Nothing, Nothing    ' Load the
file
> .X

> > >   MS_Mesh.ScaleMesh MeshScale, MeshScale, MeshScale ' Set the scale

> > >   FR_Mesh.SetPosition Nothing, X, y, Z ' Set the position
> > >   FR_Mesh.AddVisual MS_Mesh  ' Add the mesh to its frame

> > > End Sub



Mon, 26 Sep 2005 07:38:26 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Moving Meshes

2. NewbieQ - Moving a loaded mesh

3. Move a mesh

4. Mesh Names or Mesh Subset Names

5. Mesh Picking, Boned Animation, Faked Meshes

6. Progressive meshes / Simplifying meshes

7. Mesh generation

8. Shaded Mesh over VB5 forms?

9. How to get the W component from a Mesh

10. Rotate A Mesh : Precudure

11. Transform Vector or Mesh(Not addressed here)

12. resizing mesh's Vertex buffer

 

 
Powered by phpBB® Forum Software