Skip to content

refactor: isKinematic set to true for rigid bodies of non-authorized instances #886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
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
15 changes: 12 additions & 3 deletions testproject/Assets/Tests/Manual/Scripts/RandomMovement.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
using UnityEngine;
using MLAPI;

namespace TestProject.ManualTests
{
/// <summary>
/// Used with GenericObjects to randomly move them around
/// </summary>
public class RandomMovement : MonoBehaviour, IPlayerMovement
public class RandomMovement : NetworkBehaviour, IPlayerMovement
{
private Vector3 m_Direction;
private Rigidbody m_Rigidbody;

public void Start()

public override void NetworkStart()
{
m_Rigidbody = GetComponent<Rigidbody>();
ChangeDirection(true, true);
if (NetworkObject != null && m_Rigidbody != null)
{
m_Rigidbody.isKinematic = !NetworkObject.IsOwner;
if (!m_Rigidbody.isKinematic)
{
ChangeDirection(true, true);
}
}
}

public void Move(int speed)
Expand Down