Skip to content

Commit 6204d18

Browse files
authored
[Beam] Fix on SofaBeamAdapter orientation and remove some warnings in scenes due to SOFA changes (#210)
* [scenes] Fix FixConstraint alias warning * Backup fix on SofaBeamAdapter orientation * backup camera texture prefab
1 parent 1dd375e commit 6204d18

9 files changed

Lines changed: 27 additions & 26 deletions

File tree

Core/Resources/Textures/Camera_texture.renderTexture

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ RenderTexture:
1010
m_ImageContentsHash:
1111
serializedVersion: 2
1212
Hash: 00000000000000000000000000000000
13-
m_ForcedFallbackFormat: 4
14-
m_DownscaleFallback: 0
1513
m_IsAlphaChannelOptional: 0
16-
serializedVersion: 5
14+
serializedVersion: 6
1715
m_Width: 1024
1816
m_Height: 1024
1917
m_AntiAliasing: 1
@@ -24,6 +22,7 @@ RenderTexture:
2422
m_GenerateMips: 1
2523
m_SRGB: 0
2624
m_UseDynamicScale: 0
25+
m_UseDynamicScaleExplicit: 0
2726
m_BindMS: 0
2827
m_EnableCompatibleFormat: 1
2928
m_EnableRandomWrite: 0

Core/Scripts/Modules/Components/SofaBeamAdapterModel.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ protected override void UpdateBeamMesh()
9696

9797
// update position vectors for camera
9898
Vector3 sofaScale = m_sofaMesh.m_sofaContext.GetScaleSofaToUnity();
99-
99+
100100
m_tipPosition[0] = m_vertCenter[0][0] * sofaScale[0] + this.transform.position[0];
101101
m_tipPosition[1] = m_vertCenter[0][1] * sofaScale[1] + this.transform.position[1];
102102
m_tipPosition[2] = m_vertCenter[0][2] * sofaScale[2] + this.transform.position[2];
@@ -141,9 +141,11 @@ void UpdateCamera()
141141
if (m_childCameraScript == null)
142142
return;
143143

144-
145-
m_childCameraScript.transform.position = m_tipPosition;
146-
m_childCameraScript.transform.forward = m_tipDirection;
144+
145+
Vector3 localPos = m_sofaMesh.m_sofaContext.transform.TransformPoint(m_vertCenter[0]);
146+
Vector3 localPosN = m_sofaMesh.m_sofaContext.transform.TransformPoint(m_vertCenter[1]);
147+
m_childCameraScript.transform.position = localPos;// m_sofaMesh.m_sofaContext.transform.TransformPoint(m_tipPosition);
148+
m_childCameraScript.transform.forward = (localPos - localPosN);
147149
}
148150

149151

Scenes/Demos/Endoscopy/BeamAdapter/SofaScenes/BeamTexture.scn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
startingPos="0 0 0 0 -0.7071068 0 0.7071068" xtip="0 0 0"
5959
step="0.5" speed="0.0"
6060
listening="1" controlledInstrument="0"/>
61-
<FixedConstraint name="FixedConstraint" indices="0" />
61+
<FixedProjectiveConstraint name="FixedConstraint" indices="0" />
6262
<RestShapeSpringsForceField name="RestSPForceField" points="@DeployController.indexFirstNode" angularStiffness="1e20" stiffness="1e20"/>
6363
<LinearSolverConstraintCorrection wire_optimization="true" />
6464

Scenes/Demos/Endoscopy/BeamAdapter/SofaScenes/KV1-Catheter.scn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
/>
6666

6767
<LinearSolverConstraintCorrection printLog="0" wire_optimization="true"/>
68-
<FixedConstraint name="FixStart1" indices="0" />
68+
<FixedProjectiveConstraint name="FixStart1" indices="0" />
6969
<RestShapeSpringsForceField name="RestSPForceField" points="@DeployController.indexFirstNode" angularStiffness="1e8" stiffness="1e8"/>
7070

7171
<!-- COLLISION

Scenes/Demos/Endoscopy/BeamAdapter/SofaScenes/Ureteroscopy_demo.scn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
speed="0.0" startingPos="3 3 -4 0.4689105 0.5470623 0 0.6934305" step="0.1" template="Rigid3d" xtip="0.1" />
5858

5959
<LinearSolverConstraintCorrection wire_optimization="true"/>
60-
<FixedConstraint name="FixStart1" indices="0" />
60+
<FixedProjectiveConstraint name="FixStart1" indices="0" />
6161
<RestShapeSpringsForceField name="RestSPForceField" points="@DeployController.indexFirstNode" angularStiffness="1e8" stiffness="1e8"/>
6262

6363
<!-- COLLISION -->

Scenes/Demos/Endoscopy/Virtual Capsule Endoscopy/Scenes/SofaScenes/Capsule_narrow_intestin_simulation.scn

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@
4747

4848

4949
<BoxROI name="FixedROI_1" box="-4.1 9.4 1.9 -3.7 11.6 4.1" drawBoxes="0" position="@dofs.rest_position"/>
50-
<FixedConstraint name="ROI1" indices="@FixedROI_1.indices" />
50+
<FixedProjectiveConstraint name="ROI1" indices="@FixedROI_1.indices" />
5151

5252
<BoxROI name="FixedROI_2" box="-4.1 9.4 1.9 -1.9 11.6 2.3" drawBoxes="0" position="@dofs.rest_position"/>
53-
<FixedConstraint name="ROI2" indices="@FixedROI_2.indices" />
53+
<FixedProjectiveConstraint name="ROI2" indices="@FixedROI_2.indices" />
5454

5555
<BoxROI name="FixedROI_3" box="-4.1 11.2 1.9 -1.9 11.6 4.1" drawBoxes="0" position="@dofs.rest_position"/>
56-
<FixedConstraint name="ROI3" indices="@FixedROI_3.indices" />
56+
<FixedProjectiveConstraint name="ROI3" indices="@FixedROI_3.indices" />
5757

5858
<BoxROI name="FixedROI_4" box="-4.1 9.6 1.9 -1.9 10 4.1" drawBoxes="0" position="@dofs.rest_position"/>
59-
<FixedConstraint name="ROI4" indices="@FixedROI_4.indices" />
59+
<FixedProjectiveConstraint name="ROI4" indices="@FixedROI_4.indices" />
6060

6161

6262
<DiagonalMass totalMass="0.1" />

Scenes/Demos/Endoscopy/Virtual Capsule Endoscopy/Scenes/SofaScenes/Capsule_narrow_intestin_simulation_constraint.scn

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@
2828

2929

3030
<BoxROI name="FixedROI_1" box="-4.1 9.4 1.9 -3.7 11.6 4.1" drawBoxes="0" position="@dofs.rest_position"/>
31-
<FixedConstraint name="ROI1" indices="@FixedROI_1.indices" />
31+
<FixedProjectiveConstraint name="ROI1" indices="@FixedROI_1.indices" />
3232

3333
<BoxROI name="FixedROI_2" box="-4.1 9.4 1.9 -1.9 11.6 2.3" drawBoxes="0" position="@dofs.rest_position"/>
34-
<FixedConstraint name="ROI2" indices="@FixedROI_2.indices" />
34+
<FixedProjectiveConstraint name="ROI2" indices="@FixedROI_2.indices" />
3535

3636
<BoxROI name="FixedROI_3" box="-4.1 11.2 1.9 -1.9 11.6 4.1" drawBoxes="0" position="@dofs.rest_position"/>
37-
<FixedConstraint name="ROI3" indices="@FixedROI_3.indices" />
37+
<FixedProjectiveConstraint name="ROI3" indices="@FixedROI_3.indices" />
3838

3939
<BoxROI name="FixedROI_4" box="-4.1 9.6 1.9 -1.9 10 4.1" drawBoxes="0" position="@dofs.rest_position"/>
40-
<FixedConstraint name="ROI4" indices="@FixedROI_4.indices" />
40+
<FixedProjectiveConstraint name="ROI4" indices="@FixedROI_4.indices" />
4141

4242
<DiagonalMass totalMass="0.1" />
4343
<TetrahedralCorotationalFEMForceField name="FEM" youngModulus="60" poissonRatio="0.3" method="large" />

Scenes/Demos/Endoscopy/Virtual Capsule Endoscopy/Scenes/SofaScenes/Capsule_simulation.scn

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@
2424

2525

2626
<BoxROI name="FixedROI_1" box="-1 7 2 -7 8.5 5" drawBoxes="0" position="@dofs.rest_position"/>
27-
<FixedConstraint name="ROI1" indices="@FixedROI_1.indices" />
27+
<FixedProjectiveConstraint name="ROI1" indices="@FixedROI_1.indices" />
2828

2929
<BoxROI name="FixedROI_2" box="-1 8 -4 -7 9.2 2" drawBoxes="1" position="@dofs.rest_position"/>
30-
<FixedConstraint name="ROI2" indices="@FixedROI_2.indices" />
30+
<FixedProjectiveConstraint name="ROI2" indices="@FixedROI_2.indices" />
3131

3232
<BoxROI name="FixedROI_3" box="-1 11 -4 -7 12 0.5" drawBoxes="0" position="@dofs.rest_position"/>
33-
<FixedConstraint name="ROI3" indices="@FixedROI_3.indices" />
33+
<FixedProjectiveConstraint name="ROI3" indices="@FixedROI_3.indices" />
3434

3535
<BoxROI name="FixedROI_4" box="-4.5 11 -1 -7 12 2" drawBoxes="0" position="@dofs.rest_position"/>
36-
<FixedConstraint name="ROI4" indices="@FixedROI_4.indices" />
36+
<FixedProjectiveConstraint name="ROI4" indices="@FixedROI_4.indices" />
3737

3838
<DiagonalMass totalMass="0.1" />
3939
<TetrahedralCorotationalFEMForceField name="FEM" youngModulus="100" poissonRatio="0.3" method="large" />

Scenes/Demos/Endoscopy/Virtual Capsule Endoscopy/Scenes/SofaScenes/Capsule_simulation_constraint.scn

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@
2323
<HexahedronFEMForceField name="FEM" youngModulus="100.0" poissonRatio="0.3" method="large" printLog="0" />
2424

2525
<BoxROI name="FixedROI_1" box="-1 7 2 -7 8.5 5" drawBoxes="1" position="@dofs.rest_position"/>
26-
<FixedConstraint name="ROI1" indices="@FixedROI_1.indices" />
26+
<FixedProjectiveConstraint name="ROI1" indices="@FixedROI_1.indices" />
2727

2828
<BoxROI name="FixedROI_2" box="-1 8 -4 -7 9 0" drawBoxes="1" position="@dofs.rest_position"/>
29-
<FixedConstraint name="ROI2" indices="@FixedROI_2.indices" />
29+
<FixedProjectiveConstraint name="ROI2" indices="@FixedROI_2.indices" />
3030

3131
<BoxROI name="FixedROI_3" box="-1 11 -4 -7 12 0.5" drawBoxes="1" position="@dofs.rest_position"/>
32-
<FixedConstraint name="ROI3" indices="@FixedROI_3.indices" />
32+
<FixedProjectiveConstraint name="ROI3" indices="@FixedROI_3.indices" />
3333

3434
<BoxROI name="FixedROI_4" box="-4.5 11 -1 -7 12 2" drawBoxes="1" position="@dofs.rest_position"/>
35-
<FixedConstraint name="ROI4" indices="@FixedROI_4.indices" />
35+
<FixedProjectiveConstraint name="ROI4" indices="@FixedROI_4.indices" />
3636

3737
<UncoupledConstraintCorrection />
3838

0 commit comments

Comments
 (0)