ThePentiumGuy Posted June 4, 2004 Posted June 4, 2004 hey, when i try to do collision detection with meshes using mesh.intersect- when you provide the ray position and direction, where does the ray originate from? the center of the mesh? or does it protrude from the entire surface? thanks, pent Quote 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
Kavan Posted June 4, 2004 Posted June 4, 2004 When using mesh.intersect try to imagine it as a line test against a mesh. So you can have your ray start anywhere you want. It is usually used to test if a mouse is over a mesh. Your mouse defines the ray and you're interested if the ray intersects the mesh. You could also use it for other purposes like collision detection but have in mind that it's performance is not very good. So it will only be good for very small games, otherwise try to get some other technique for collision detection. Quote
ThePentiumGuy Posted June 5, 2004 Author Posted June 5, 2004 When using mesh.intersect try to imagine it as a line test against a mesh. So you can have your ray start anywhere you want. It is usually used to test if a mouse is over a mesh. Your mouse defines the ray and you're interested if the ray intersects the mesh. You could also use it for other purposes like collision detection but have in mind that it's performance is not very good. So it will only be good for very small games' date=' otherwise try to get some other technique for collision detection.[/quote'] i had no idae mesh.intersct woudl be slow lol -but im only using it for htis purpose: checking whetehr the car is on the platform by drawing a ray from the platform to above the platform and seeing whether it intersects the car (if platform.intersect(car.position,belowthecar.position) however, yopu said that you can specify where the ray starts - how would you do this, pent Quote 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
Kavan Posted June 5, 2004 Posted June 5, 2004 It's Mesh.Intersect(rayStart, rayDirection). So your one should be like platform.intersect(car.position,vector3.subtract(belowthecar.position,car.position)) Quote
ThePentiumGuy Posted June 6, 2004 Author Posted June 6, 2004 It's Mesh.Intersect(rayStart, rayDirection). So your one should be like platform.intersect(car.position,vector3.subtract(belowthecar.position,car.position)) what does vector3.subtract do? Quote 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
Administrators PlausiblyDamp Posted June 6, 2004 Administrators Posted June 6, 2004 You may be surprised to find that MSDN says that it: Subtracts two 3-D vectors Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
ThePentiumGuy Posted June 6, 2004 Author Posted June 6, 2004 plausiblydamp: :p lol Quote 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
ThePentiumGuy Posted June 9, 2004 Author Posted June 9, 2004 found some stuff regarding Vertex.Subtratcion: A subtracted vertex results in a vertex with its head(where it starts) originating from the tail of the first vertex, and its "direction" heading towards the head of the other vertex.. o_O what's that gotta do with the platform thing, im trying to draw this out in Paint bnut i cant see how it relates? pent Quote 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
Kavan Posted June 9, 2004 Posted June 9, 2004 It looks like you're in need of a course in linear algebra. What does it have to do with your problem? Mesh.Intersect takes start of the ray and ray direction as its parameters. You only have start of the ray and another point on the ray. So you have to compute ray direction. You do this with Vector.Subtract. Of course you can always just take (0,-1,0) for your ray direction if I understand how you want to use it. Quote
ThePentiumGuy Posted June 10, 2004 Author Posted June 10, 2004 ohh, i see :) yeah you're right, (0,-1,0) would work -> earlier, i had it in mind that the direction is when direct3d takes the 2 arguments and finds the direction, now i see direction means.. like literally direction.. very vague explanation on my part :)_ but tahnks a lot, i understand it now - im gonna test it out Quote 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
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.