Results 1 to 4 of 4

Thread: Mesh Matrix wth...

  1. #1

    Mesh Matrix wth...

    ok i've run into another wall.... i wasnt sure which section to post this so i posted here. ok since working on my 3d engine, i have always loaded static meshes (.x)

    all works perfect, .... until now... now i want to move meshes around in my 'world' and i have no idea how todo it. or at least i know it is something todo with the matrix local or something. but thats all i know. so..

    for my world i use this. which allows me to move my camera around in my world (.x) map/model

    [code="delphi"]
    procedure TEngine.SetupViewCam;
    var
    matView: TD3DMatrix;
    begin
    D3DXMatrixLookAtLH(matView, Cam.Position, Cam.Direction, Cam.vUpVec);
    ResMan.DX_Device.SetTransform(D3DTS_VIEW, matView);
    D3DXMatrixPerspectiveFovLH(matView, D3DX_PI/4, Cam.ViewAspect, 0.1, 4000.0);
    ResMan.DX_Device.SetTransform(D3DTS_PROJECTION, matView);
    end;
    [/code]

    which is called each once before a frame render / after processing mouse/keyboard input.

    now i want to load a mesh of lets say a ball or a box. and would like to move it around. how would i go about this?

    hope someone understands and can help. thanks,

  2. #2

    Re: Mesh Matrix wth...

    You should make a "world matrix" and apply it using Device.SetTransform(D3DTS_WORLD, Your_World_Matrix).

    For example:

    Code:
    D3DXMatrixTranslation(MyWrldMat, 100, 0, 0);
    Device.SetTransform(D3DTS_WORLD, MyWrldMat);
    
    //Draw your translated mesh now
    
    D3DXMatrixRotateY(MyWrldMat, 0.5 * Pi);
    Device.SetTransform(D3DTS_WORLD, MyWrldMat);
    
    //Draw another model that will be rotated 90 degrees about the Y Axis
    
    D3DXMatrixScaling(MyWrldMat, 2, 2, 2);
    Device.SetTransform(D3DTS_WORLD, MyWrldMat);
    
    //Draw another model that will appear two times as big as the original
    It's actually very simple.
    Take a look at the following pages:

    http://msdn.microsoft.com/en-us/library/bb205367(VS.85).aspx
    http://msdn.microsoft.com/en-us/library/bb205359(VS.85).aspx
    http://msdn.microsoft.com/en-us/library/bb205363(VS.85).aspx

    Etc... Also usefull:

    http://www.drunkenhyena.com/pages/pr...3d_lesson4.php
    http://www.directxtutorial.com/Tutor...ics/dx9B5.aspx
    http://msdn.microsoft.com/en-us/library/bb206269(VS.85).aspx

    Etc... google is your friend.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  3. #3

    Re: Mesh Matrix wth...

    And not to forget clootie's site: http://www.clootie.ru/
    http://3das.noeska.com - create adventure games without programming

  4. #4

    Re: Mesh Matrix wth...

    Quote Originally Posted by chronozphere
    google is your friend.
    google is not my friend ... lol.. i have mensioned in other posts why, which i won't bother to repeat but....

    http://www.pascalgamedevelopment.com...;topicseen#new

    this is a clue, i like this forum and community, so i'd like to be regged on a forum that stays active for a change

    anyways i will check those links and thanks for example, i think i understand now.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •