JointDriveMode is obsolete MpFPS E5

Updated on April 25, 2017 in [A] Tutorials
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
0 on April 25, 2017

How can I make the script on E5 from the multiplayer fps series work at the current version (5.6.0f3)
pls reply Here is my code :

using UnityEngine;
[RequireComponent(typeof(ConfigurableJoint))]
[RequireComponent(typeof(PlayerMotor))]
public class PlayerController : MonoBehaviour {
    [SerializeField]
private float speed = 5f;
[SerializeField]
private float lookSencitivity = 3f;
    [SerializeField]
private float thrusterForce = 1000f;
    [Header(“Joint options :”)]
[SerializeField]
private JointDriveMode jointmode = JointDriveMode.Position;
[SerializeField]
private float jointSpring = 20f;
[SerializeField]
private float jointMaxForce = 40f;
    private PlayerMotor motor;
private ConfigurableJoint joint;
     void Start ()
{
motor = GetComponent<PlayerMotor>();
joint = GetComponent<ConfigurableJoint>();
        SetJointSettings(jointSpring);
    }
     void Update ()
{
//calculate movement velocity as a 3D vector
float _xMov = Input.GetAxisRaw(“Horizontal”);
float _zMov = Input.GetAxisRaw(“Vertical”);
        Vector3 _movHorizontal = transform.right * _xMov;
Vector3 _movVertical = transform.forward * _zMov;
        //Final movement vector
Vector3 _velocity = (_movHorizontal + _movVertical).normalized * speed;
        //apply movement
motor.Move(_velocity);
        //rotation
float _yRot = Input.GetAxisRaw(“Mouse X”);
        Vector3 _rotation = new Vector3(0f, _yRot, 0f) * lookSencitivity;
        //apply rotation
        motor.Rotate(_rotation);
// Camera rotation
float _XRot = Input.GetAxisRaw(“Mouse Y”);
        Vector3 _cameraRotation = new Vector3( _XRot, 0f, 0f) * lookSencitivity;
        //apply rotation
        motor.RotateCamera(_cameraRotation);
        //calc the thruster force
        Vector3 _thrusterforce = Vector3.zero;
        if(Input.GetButton(“Jump”))
{
_thrusterforce = Vector3.up * thrusterForce;
SetJointSettings(0f);
}else
{
SetJointSettings(jointSpring);
}
        //apply the thruster force
        motor.ApplyThruster(_thrusterforce);
}
private void  SetJointSettings (float _jointSpring)
{
joint.yDrive = new JointDrive {mode = jointmode ,positionSpring =jointSpring , maximumForce = jointMaxForce };
}
}

(I have stopped the vid at the 23.46)

  • Liked by
  • iftee939
  • Nublys
Reply