Rekindled Phoenix Posted June 18, 2010 Share Posted June 18, 2010 What is the difference between Core.TPick and the OOP Pick besides Struct vs. Class? Is there a function in the wrapper that takes the Pick class? Heh, is there a way to delete forum posts, now that I've made a fool of myself? Quote Link to comment Share on other sites More sharing options...
TylerH Posted June 18, 2010 Share Posted June 18, 2010 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. Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
Rekindled Phoenix Posted June 18, 2010 Author Share Posted June 18, 2010 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? Quote Link to comment Share on other sites More sharing options...
macklebee Posted June 18, 2010 Share Posted June 18, 2010 just out of curiosity, have you set the Collisions response? The pick is only going to work if the collision response you set for static objects and also the raycast has been defined. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Rekindled Phoenix Posted June 18, 2010 Author Share Posted June 18, 2010 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) Quote Link to comment Share on other sites More sharing options...
ZioRed Posted June 18, 2010 Share Posted June 18, 2010 The only difference between your Entity.CollisionType set and Core.EntityType call is that CollisionType set EntityType without recursion while your direct call to Core.EntityType applies recursion to its childs (last parameter = 1). Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
Rekindled Phoenix Posted June 19, 2010 Author Share Posted June 19, 2010 Thanks everyone. @ZioRed That must be the reason. Since the object is a Model, it must be setting the collision data for the Body. It's a child of Model and directly required by raycasts. Quote Link to comment Share on other sites More sharing options...
ZioRed Posted June 21, 2010 Share Posted June 21, 2010 Mh.. well I will do some tests on C/C++ to see how it works in the different situations (Entity, Mesh, Model, etc) and I will update the wrapper accordingly if needed. But it's strange if on C it works differently, since the default value of the recursion parameter in EntityType is 0 Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
ZioRed Posted June 21, 2010 Share Posted June 21, 2010 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. Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
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.
Note: Your post will require moderator approval before it will be visible.