Jump to content

Collision Types and Raycasting


Rekindled Phoenix
 Share

Recommended Posts

Seems like a legitimate question? I can look if you would like a full explanation, because I honestly don't know off of the top of my head.

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

To answer my own question: The OOP Wrapper has the namespace 'Raycasting' which takes the Class Pick. The namespace 'Core' which implements the original API, takes a Struct TPick.

 

What's actually got me stuck is the raycasting only working when I use 0 for the collision type filter. I have an enumeration of collision types, and each time I create an object I set the appropriate value like this:

 

 [Object].CollisionType = CollisionTypes.StaticObjects

 

So when I want to only find the nearest static object where the mouse is...

 

Dim TempPick As Pick = New Pick
Dim Location As Vector3 = New Vector3(MouseX, MouseY, 200)
Raycasting.CameraPick(TempPick, Framework.Layers.Main.Camera, Location, 1, CollisionTypes.StaticObjects) 

 

Yet when this doesn't work! Can anyone test this?

Link to comment
Share on other sites

Yes, and by accident discovered the solution!

 

When I was calling CameraPick, I was using the Collision type filter for the objects I was looking for. I wasn't thinking that this parameter defines the collision type for the raycast! I found this out by setting the collision type to 'Player' as a wild experiment, and it responded to only the terrain collision enum value. After changing the following code, I got it to work.

 

Added 'Raycasts' to my CollisionTypes Enumeration.

Added Core.Collisions(CollisionTypes.StaticObjects, CollisionTypes.Raycasts, 1)

Updated CameraPick(..., CollisionTypes.Raycasts)

 

Fixed!

 

Also, the wrapper when setting the propery collision type doesn't work the same as setting the entity type value. Does anyone know why?

 

Replaced

[Object].CollisionType = CollisionTypes.StaticObjects

with... Core.EntityType([Object].Pointer, CollisionTypes.StaticObjects, 1)

Link to comment
Share on other sites

EDIT: sorry I was wrong in the C demo which I tried, I was trying LoadMesh instead of LoadModel, now it's confirmed that you have the same behaviour on both C/C++ and C#, that is setting collision type to a model does not affect the collision type of its children if you don't set 1 to recursion parameter of EntityType. So this is not a bug.

?? FRANCESCO CROCETTI ??

http://skaredcreations.com

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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.

 Share

×
×
  • Create New...