Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

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
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.
Posted
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

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

It's Mesh.Intersect(rayStart, rayDirection). So your one should be like

platform.intersect(car.position,vector3.subtract(belowthecar.position,car.position))

Posted
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?

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

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

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

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.

Posted

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

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

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...