21-02-2024, 06:09 PM
When i use in unity
The Obi Rope is not simulated. Do I understand correctly that Obi Rope need to be simulated in a separate script? If it is true, how i can do this?
I'm developing a game where i need to detect in my server that user actually wins. My full code of simulation process:
When i start it, Obi Rope behave unpredictably
Code:
Physics.Simulate(Time.fixedDeltaTime);
I'm developing a game where i need to detect in my server that user actually wins. My full code of simulation process:
Code:
private void Start() {
Physics.simulationMode = SimulationMode.Script;
Simulate();
}
private void Simulate() {
GameObject machine = Instantiate(machinePrefab);
MachineController controller = machine.GetComponent<MachineController>();
APIMachineControlStateRequest request = JsonUtility.FromJson<APIMachineControlStateRequest>(json);
controller.SetSimulate(Physics.defaultPhysicsScene);
foreach(MachineControlState state in request.value) {
controller.SetState(state);
Physics.Simulate(Time.fixedDeltaTime);
}
}