@@ -24,6 +24,7 @@ ROS URDf
24
24
using System . Collections . Generic ;
25
25
using System . Xml ;
26
26
using System . IO ;
27
+ using System . Globalization ;
27
28
28
29
using URDFJoint = URDFRobot . URDFJoint ;
29
30
using URDFLink = URDFRobot . URDFLink ;
@@ -309,7 +310,7 @@ public struct Options {
309
310
primitiveGameObject = GameObject . CreatePrimitive ( PrimitiveType . Sphere ) ;
310
311
primitiveTransform = primitiveGameObject . transform ;
311
312
312
- float sphereRadius = float . Parse ( primitiveNode . Attributes [ "radius" ] . Value ) ;
313
+ float sphereRadius = float . Parse ( primitiveNode . Attributes [ "radius" ] . Value , CultureInfo . InvariantCulture ) ;
313
314
primitiveTransform . localScale = Vector3 . one * sphereRadius * 2 ;
314
315
break ;
315
316
@@ -323,8 +324,8 @@ public struct Options {
323
324
GameObject cylinderPrimitive = GameObject . CreatePrimitive ( PrimitiveType . Cylinder ) ;
324
325
cylinderPrimitive . transform . parent = primitiveTransform ;
325
326
326
- float length = float . Parse ( primitiveNode . Attributes [ "length" ] . Value ) ;
327
- float radius = float . Parse ( primitiveNode . Attributes [ "radius" ] . Value ) ;
327
+ float length = float . Parse ( primitiveNode . Attributes [ "length" ] . Value , CultureInfo . InvariantCulture ) ;
328
+ float radius = float . Parse ( primitiveNode . Attributes [ "radius" ] . Value , CultureInfo . InvariantCulture ) ;
328
329
primitiveTransform . localScale = new Vector3 ( radius * 2 , length / 2 , radius * 2 ) ;
329
330
break ;
330
331
@@ -640,9 +641,9 @@ public static Vector3 TupleToVector3(string str) {
640
641
641
642
try {
642
643
643
- result . x = float . Parse ( numbers [ 0 ] ) ;
644
- result . y = float . Parse ( numbers [ 1 ] ) ;
645
- result . z = float . Parse ( numbers [ 2 ] ) ;
644
+ result . x = float . Parse ( numbers [ 0 ] , CultureInfo . InvariantCulture ) ;
645
+ result . y = float . Parse ( numbers [ 1 ] , CultureInfo . InvariantCulture ) ;
646
+ result . z = float . Parse ( numbers [ 2 ] , CultureInfo . InvariantCulture ) ;
646
647
647
648
} catch ( Exception e ) {
648
649
@@ -667,10 +668,10 @@ public static Color TupleToColor(string str) {
667
668
if ( numbers . Length == 4 ) {
668
669
669
670
try {
670
- result . r = float . Parse ( numbers [ 0 ] ) ;
671
- result . g = float . Parse ( numbers [ 1 ] ) ;
672
- result . b = float . Parse ( numbers [ 2 ] ) ;
673
- result . a = float . Parse ( numbers [ 3 ] ) ;
671
+ result . r = float . Parse ( numbers [ 0 ] , CultureInfo . InvariantCulture ) ;
672
+ result . g = float . Parse ( numbers [ 1 ] , CultureInfo . InvariantCulture ) ;
673
+ result . b = float . Parse ( numbers [ 2 ] , CultureInfo . InvariantCulture ) ;
674
+ result . a = float . Parse ( numbers [ 3 ] , CultureInfo . InvariantCulture ) ;
674
675
675
676
} catch ( Exception e ) {
676
677
0 commit comments