Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion unity/Runtime/Components/Joints/MjHingeJoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protected override XmlElement OnGenerateMjcf(XmlDocument doc) {
throw new ArgumentException("Lower range value can't be bigger than Higher");
}
mjcf.SetAttribute("range", MjEngineTool.MakeLocaleInvariant($"{RangeLower} {RangeUpper}"));
mjcf.SetAttribute("ref", $"{Configuration}");
mjcf.SetAttribute("ref", MjEngineTool.MakeLocaleInvariant($"{Configuration}"));

return mjcf;
}
Expand Down
14 changes: 14 additions & 0 deletions unity/Tests/Editor/Components/Joints/MjHingeJointTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Xml;
using NUnit.Framework;
using UnityEngine;
Expand Down Expand Up @@ -68,6 +69,19 @@ public void GenerateLimits() {
Assert.That(_doc.OuterXml, Does.Contain(@"range=""-20 10"""));
}

[Test]
public void GenerateReferenceUsesInvariantCulture() {
var previousCulture = CultureInfo.CurrentCulture;
CultureInfo.CurrentCulture = new CultureInfo("fr-FR");
try {
_joint.Configuration = 1.5f;
var element = _joint.GenerateMjcf("name", _doc);
Assert.That(element.GetAttribute("ref"), Is.EqualTo("1.5"));
} finally {
CultureInfo.CurrentCulture = previousCulture;
}
}

[Test]
public void ParsingPosition() {
var jointElement = (XmlElement)_doc.AppendChild(_doc.CreateElement("joint"));
Expand Down