Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

also another q, im just gonna post it here becuase i dont wanna make too many posts,

 

when you check for collision - does the Mesh.Intersect "know about" the trasnformed positions?

meaning, if you keep the car msh in the same place, but you move the platform

when you check for collision using platform.intersect(car.position, new v3(0,1,0)),

would the mesh.intersect 'realize' taht the platform has been moving down the entire time, or will it just use the model space positions (which havent been transformed)

 

pent

My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!)

vbprogramming.8k.com

My Project (Need VB.NET Programmers)

http://workspaces.gotdotnet.com/ResolutionRPG

Posted

Lights are not transformed = they are in world space

 

Mesh.Intersect does not know of transformations = it works in model space

Posted
Are you sure about the Mesh.Intersect thing Kavan cause i remember using only one mesh (a 2 triangle square) for all my intersects by translating it around my grid. (looks for code).
Posted

rifter: what Kavan said seems to be right becuase all you're inputting in the arguments are the position and direction. if it was in world space, it would be even more confusing

 

btw - i tried this out - i translated thje world in various places, and tried mesh.intersect and the collision happens in the same place every time - no matter where you translate the world, so i think its model space coordinates

 

thanks both of you

 

pent

My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!)

vbprogramming.8k.com

My Project (Need VB.NET Programmers)

http://workspaces.gotdotnet.com/ResolutionRPG

Posted

Um then this shouldnt have worked

 

However the following worked for using a single (150x150x0) square mesh to check the tops of a (3x150)x(2x150) landscape.


       For i = 0 To blgrid.GetUpperBound(0)
           For i2 = 0 To blgrid.GetUpperBound(1)
               If blgrid(i, i2).Exsists Then
                   D3d.Device.Transform.World = D3d.Translate(blgrid(i, i2).pos.X, blgrid(i, i2).Alt, blgrid(i, i2).pos.Y)
                   v3dmouse = Vector3.Subtract(D3d.UnProject(New Vector3(Mouse.X, Mouse.Y, -100)), D3d.UnProject(New Vector3(Mouse.X, Mouse.Y, 100)))
                   If modBattle.GridTopMesh.Intersect(D3d.UnProject(New Vector3(Mouse.X, Mouse.Y, -100)), v3dmouse) Then
                       BLP.x = i
                       BLP.y = i2
                       Exit Sub
                   End If
               End If
           Next
      Next

Posted
However the following worked for using a single (150x150x0) square mesh to check the tops of a (3x150)x(2x150) landscape.

[/size]
[size=1] [/size]
[size=1]For i = 0 To blgrid.GetUpperBound(0)[/size]
[size=1]For i2 = 0 To blgrid.GetUpperBound(1)[/size]
[size=1]If blgrid(i, i2).Exsists Then[/size]
[size=1]D3d.Device.Transform.World = D3d.Translate(blgrid(i, i2).pos.X, blgrid(i, i2).Alt, blgrid(i, i2).pos.Y)[/size]
[size=1]v3dmouse = Vector3.Subtract(D3d.UnProject(New Vector3(Mouse.X, Mouse.Y, -100)), D3d.UnProject(New Vector3(Mouse.X, Mouse.Y, 100)))[/size]
[size=1]If modBattle.GridTopMesh.Intersect(D3d.UnProject(New Vector3(Mouse.X, Mouse.Y, -100)), v3dmouse) Then[/size]
[size=1]BLP.x = i[/size]
[size=1]BLP.y = i2[/size]
[size=1]Exit Sub[/size]
[size=1]End If[/size]
[size=1]End If[/size]
[size=1]Next[/size]
[size=1]Next[/size]
[size=1]

sry man im not that advanced in d3d yet to understand this :-\

My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!)

vbprogramming.8k.com

My Project (Need VB.NET Programmers)

http://workspaces.gotdotnet.com/ResolutionRPG

Posted
D3d is just a wrapper class of Edit(Managed) directx (custom made by yours truely) Most of its usefullness is in other areas such as Skinning Meshs where it has working implementations and has some good vertexBuffer constructors and such nothing really impressive.
Posted
Ok, but the main part is done using Unproject. I guess this one uses the currently set world matrix. You could use Vector3.Unproject to get the same result without setting world matrix.
Posted
Vector3.unproject takes in the world matrix. (and viewport and one other matrix (cant think of it off the top of my head)). So yes thats where all of the World matrix transformations are accounted for.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...