-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathSofaCollisionPipelineAPI.cs
More file actions
58 lines (46 loc) · 1.91 KB
/
SofaCollisionPipelineAPI.cs
File metadata and controls
58 lines (46 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using UnityEngine;
using System;
using System.Runtime.InteropServices;
namespace SofaUnityAPI
{
/// <summary>
/// Class used to handle bindings to the Sofa collision pipeline components: I.e:
/// CollisionPipeline, BroadPhase, NarrowPhase and Collisionresponse
/// </summary>
public class SofaCollisionPipelineAPI : SofaBaseObjectAPI
{
public SofaCollisionPipelineAPI(IntPtr simu, string nameID)
: base(simu, nameID, "root", false)
{
}
/// Destructor
~SofaCollisionPipelineAPI()
{
Dispose(false);
}
/// Implicit method to really create object and link to Sofa object. Called by SofaBaseObject constructor
protected override bool createObject()
{
if (m_hasObject == false) // first time create object only
{
// Create the cube
int res = sofaPhysicsAPI_addCollisionPipeline(m_simu);
if (res != 0)
{
Debug.LogError("SofaCollisionPipelineAPI::createObject creation method return error: " + SofaDefines.msg_error[res] + " for object " + m_name);
return false;
}
if (displayLog)
Debug.Log("SofaCollisionPipeline Added! " + m_name);
m_hasObject = true;
return true;
}
return false;
}
/////////////////////////////////////////////////////////////////////////////////////////
//////////// Communication API to sofaPhysicsAdvanceAPI ////////////////
/////////////////////////////////////////////////////////////////////////////////////////
[DllImport("SofaVerseAPI", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
public static extern int sofaPhysicsAPI_addCollisionPipeline(IntPtr obj);
}
}