[.net] [Resolved[Problems with ODE.NET and TriMeshes

This topic is 4626 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hey everyone, In ODE.NET, I have made a simulation of various boxes (ODE.Geoms.Box) falling and stacking on a plane (ODE.Geoms.Plane). This works nicely, so now Im trying to modify it to use actual triangles instead of predefined primitives. Swapping this code, Space.Add(New Geoms.Plane(New Vector3(0, 1, 0), -2)) with
        Dim v(4 - 1) As Vector3
v(0) = New Vector3(-20, -2, -20)
v(1) = New Vector3(20, -2, -20)
v(2) = New Vector3(20, -2, 20)
v(3) = New Vector3(-20, -2, 20)
Dim iv(6 - 1) As Integer
iv(0) = 0
iv(1) = 1
iv(2) = 2
iv(3) = 2
iv(4) = 3
iv(5) = 0


Some boxes fall and stack correctly or land correctly, some land correctly then "roll into" the ground and out under the flat surface and some go right through. If I use my own collision callback, or the default collider, I still get the same problem. Using Quickstep with 100 iterations or Timestep, gives me the same problem. Manually creating a new vertex list with the index buffer, and only specifying the vertices, makes no difference. ODE setup code
    Public Shared World As ODE.World
Public Shared Space As ODE.Space
Dim ContactJoints As Joints.JointGroup

World = New World
Space = New Space

World.Gravity = New Vector3(0, -1, 0)

Dim v(4 - 1) As Vector3
v(0) = New Vector3(-20, -2, -20)
v(1) = New Vector3(20, -2, -20)
v(2) = New Vector3(20, -2, 20)
v(3) = New Vector3(-20, -2, 20)
Dim iv(6 - 1) As Short
iv(0) = 0
iv(1) = 1
iv(2) = 2
iv(3) = 1
iv(4) = 3
iv(5) = 2
'Space.Add(New Geoms.Plane(New Vector3(0, 1, 0), -2))


Collision callback
    Private Sub CollisionCallback(ByVal Contacts() As Joints.ContactInfo, ByVal GeomA As Geoms.Geom, ByVal GeomB As Geoms.Geom)
Dim I As Integer = 0
For I = 0 To Contacts.Length - 1
With Contacts(I).SurfaceParams
.Mode = Joints.ContactMode.Bounce Or Joints.ContactMode.FrictionApprox1
.Bounce = 0.05
.BounceVel = 0.03
.Mu = 0.5
End With

Dim Joint As Joints.Contact = New Joints.Contact(World, Contacts(I), ContactJoints)
Joint.Attach(GeomA.RigidBody, GeomB.RigidBody)
Next
End Sub


Physics tick
[source="vb"]
Private Sub Tick()
Space.Collide()
'World.QuickStep(TimeElapse / 200, 100)
World.TimeStep(TimeElapse / 200)
ContactJoints.Clear()
End Sub


The only objects in the world, are a few boxes (ODE.Geoms.Box) and the trimesh I'm trying to use as the ground. Thanks :) [Edited by - CadeF on April 17, 2006 3:03:09 AM]

Share on other sites
Figured it out, winding order needed to be reversed.

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 13
• 26
• 10
• 11
• 9
• Forum Statistics

• Total Topics
633734
• Total Posts
3013590
×