OFS Simulator3D Mod: Surge & Sway Fix - v1.6

If your measurements are correct, apply the following code in Simulator3D.cs, starting line 250.

		strokerMesh.GlobalRotate(Vector3.Right,
			Mathf.Deg2Rad(
				Mathf.Lerp(35.0f, -35.0f, pitch)
			)
		);

		strokerMesh.GlobalRotate(Vector3.Forward,
			Mathf.Deg2Rad(
				Mathf.Lerp(-30.0f, 30.0f, roll)
			)
		);

		strokerMesh.RotateObjectLocal(Vector3.Up, 
			Mathf.Deg2Rad(
				Mathf.Lerp(-120.0f, 120.0f, twist)
			)
		);

		strokerMesh.Translation = new Vector3(
			Mathf.Lerp(0.667f, -0.667f, sway),
			Mathf.Lerp(-1.0f, 1.0f, mainStroke),
			Mathf.Lerp(0.5f, -0.5f, surge)
		);
	}
}

About the twist, it varies according to the servo.

I measured mine but got different results.
up/down: -6cm to +6cm (12cm)
left/right: -4cm to +4cm (8cm)
forward/backward: +2.75cm to +2.75cm (5.5cm)
pitch: -28.5° to +28.5° (57°)
roll: -19° to 19° (28°)

Mine is the customized SR6 with metal bearing arms from FunOSR.
@Tempest May I ask what’s the roll and pitch range for a default SR6? Is it the same as the OSR2+?

This is how I set up the inverse Kinematics, as in the maths that’s going on inside the ESP32 to calculate the servo angles:

The design is based around a modified Stewart platform with six servos driving six arms, which connect to the receiver via six linkages. The arrangement gives a theoretical total movement range of 120mm in the up-down direction and 60mm in the left-right and forward-backward directions. The receiver can simultaneously also rotate in roll and pitch by approximately ±30 degrees.

So your values are about right. It will vary a bit because there’s variation between different models of servo.

1 Like

Update: V1.6

  • Changed Pitch and Roll of the model to 30° to better match an actual SR6. (Previously 45°)
1 Like

Dunno if it hasn’t processed yet but I can’t see the update, still shows the last release being v1.5

should now be publised

1 Like

Just found out that the angles are different for SR6 and OSR2+.

My OSR2+ with Khrull’s firmware:
Pitch: -25° to 25° (50°)
Roll: -29° to 29° (58°)

I think there might need a way to switch between the two device.

Sure about that? As you asked Tempest if they were the same which they didn’t say yes to.

I’m sure they are different by design? The OSR2+ has wider pitch and roll range than the SR6. Correct me if I’m wrong @Tempest @soritesparadox.

I think what this means for the simulator is there needs to be a way to toggle between SR6 and the OSR2+. I may do this by detecting if there exists .surge and .sway scripts.

Why I load FunscriptSimulator3D Inside ofs it shows a link error

You shouldn’t load it inside OFS. It’s a separate application that communicates with OFS via websocket.

Is there a guide for new users of this program? As someone who used to only use OFS, it’s hard to know the connection between OFS Simulator3D Mod and Gobot and how to link it.

Yes I was wondering if someone could help, I am strugling to get the background to be transparent for what is on screen, and also to change the websocket connection.

Transparency issue:

Connection issue:

I’m not sure where to set the websocket connection, or if it’s correct. I put it in the time stamp server URL, under export window. Help would be appreciated.

@Falafel @codeScripter
You guys seem to better understanding of the software than me. I already hve the 3D model as I want just need insturction on where to change stuff to make it work, thanks! :))


Just modify it here

1 Like

Try this option under project settings.

1 Like