Hi everybody,
I'm trying to do collision detection between a ray and a node.
I'm using: (irr 1.1 .Net)
Public Function GetSceneNodeFromRayBB( _
ByVal ray As Line3D, _
ByVal idBitMask As Integer _
) As ISceneNode
method of the ISceneCollisionManager class
(I had an image showing my prob but can't post it)
Anyway, I have assumed BB stands for bounding box, and have created a scene with a MD2 model. I've drawn the bounds around the model, and drawn a line along the Ray I have created which i can move around with the keyboard.
Problem is, when the line intercepts the bounding box 99% of the time the expected effect does not occur. It seems that the ray has to intercept a precise point in the box which i suspect is the origin.
On the other hand, I don't know what the bit mask should be set to and whether this would cause my problem if I have it set wrong.
So, has anyone else had this problem, am I completely misinterpreting the method, should I be doing this a different way?
I will be able to post the image and my code in about a couple hours.
Collision Detection problem
Collision Detection problem
...--== Alex ==--...
As promised here is the pic:
as you can see the ray is inside the box (it passes behind the fairies leg but infront of her hair). But the fairies has not turned wireframe
And the code:
as you can see the ray is inside the box (it passes behind the fairies leg but infront of her hair). But the fairies has not turned wireframe
And the code:
Code: Select all
Dev.VideoDriver.BeginScene(True, True, New Color(0, 120, 80, 80))
Dev.SceneManager.DrawAll()
'**************************
'Picking goes here
Dev.VideoDriver.SetTransform(TransformationState.WORLD, New Core.Matrix4)
HitNde = Dev.SceneManager.SceneCollisionManager.GetSceneNodeFromRayBB(Ply.Sight, 0, False)
If Not HitNde Is Nothing Then
If HitNde.ID >= 0 Then
oNpc = cNpc(HitNde.ID)
oNpc.Node.SetMaterialFlag(MaterialFlag.WIREFRAME, True)
End If
HitNde = Nothing
End If
Dev.VideoDriver.Draw3DLine(Ply.Sight.start, Ply.Sight.end, New Irrlicht.Video.Color(0, 255, 0, 0))
For Each oNpc In cNpc
Dev.VideoDriver.Draw3DBox(AddVector3D(oNpc.Node.Position, oNpc.Node.BoundingBox), New Irrlicht.Video.Color(0, 255, 0, 0))
Next
'**************************
Dev.VideoDriver.EndScene()
...--== Alex ==--...
Don't use Irrlicht
Okay, I've trawled the forums a bit more after not getting any reply to my questions.
I'm getting the impression that Irrlicht should not be used for collision detection, and instead to use Newton or ODE
Can we have some sort of discussion on the pro's and con's of these (or other) physics engines. I've dl'd the Newton Playground and it looks awesome btw.
a few points I would like to know are:
I'm getting the impression that Irrlicht should not be used for collision detection, and instead to use Newton or ODE
Can we have some sort of discussion on the pro's and con's of these (or other) physics engines. I've dl'd the Newton Playground and it looks awesome btw.
a few points I would like to know are:
- Ease of use
Ease of integration
What are the overheads
Documentation
Cost (money? what money!)
Which is better suited to an action game enviroment
...--== Alex ==--...