Multiplayer FPS in Unity (E05. Flying)

Updated on April 5, 2018 in [A] Brackeys Courses
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
12 on May 2, 2016

private JointDriveMode jointMode;

 

JointDriveMode -> is Obsolete now what do i do?

  • Liked by
Reply
0 on May 24, 2016

I have the same question

  • Liked by
Reply
Cancel
0 on July 13, 2016

well and i have the same question! maybe someone can help please?:)

  • Liked by
Reply
Cancel
8 on July 13, 2016

Obsolete doesn’t mean it can’t be used, you can still use it. I just don’t know what the new correct way would be

on July 13, 2016
using UnityEngine;
[RequireComponent(typeof(ConfigurableJoint))]
[RequireComponent(typeof(PlayerMotor))]
public class PlayerController : MonoBehaviour
{
 [SerializeField]
 private float speed = 5f;
 [SerializeField]
 private float lookSensitivity = 3f;
 [SerializeField]
 private float thrusterForce = 1000f;
 [Header("Spring settings:")]
 [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 our movement velocity as a 3d vector
 float _xMov = Input.GetAxisRaw("Horizontal");
 float _zMov = Input.GetAxisRaw("Vertical");
 Vector3 _moveHorizontal = transform.right * _xMov;
 Vector3 _moveVertical = transform.forward * _zMov;
 // final movement vector
 Vector3 _velocity = (_moveHorizontal + _moveVertical).normalized * speed;
 // apply movement
 motor.Move(_velocity);
 //calculate rotation as a 3d vector (turning around)
 float _yRot = Input.GetAxisRaw("Mouse X");
 Vector3 _rotation = new Vector3(0f, _yRot, 0f) * lookSensitivity;
 // apply rotation 
 motor.Rotate(_rotation);
 //calculate camera rotation as a 3d vector (turning around)
 float _xRot = Input.GetAxisRaw("Mouse Y");
 float _cameraRotationX = _xRot * lookSensitivity;
 // apply camera rotation 
 motor.RotateCamera(_cameraRotationX);
 // calculate the thrusterforce based on player input
 Vector3 _thrusterForce = Vector3.zero;
 if (Input.GetButton("Jump"))
 {
 _thrusterForce = Vector3.up * thrusterForce;
 SetJointSettings(0f);
 }
 else
 {
 SetJointSettings(jointSpring);
 }
 // apply the thrusterforce
 motor.ApplyThruster(_thrusterForce);
 }
 private void SetJointSettings(float _jointSpring)
 {
 joint.yDrive = new JointDrive
 {
 mode = jointMode,
 positionSpring = _jointSpring,
 maximumForce = jointMaxForce
 };
 }
}
Guru
on July 13, 2016

Wow beautiful code!
Well done!
I mean you post code without a question why do you post the code?

Wise
on July 13, 2016

lol
Job, just.. just take it, just take the code.
shhhhh shhh…
no questions.
sit.
read.
now.

now. 
tell me.

what have we learned?

..

nothing.
yes.
thats right.
you didnt learn anything Job.
You’re worhtless.

jk gj much luvs Job <3

on July 13, 2016

JointDriveMode -> is Obsolete now what do i do?
so does we need jointdrivemode in this script? couze it works fine without it, different is only that when there is no jointdrivemode there is no errors in console of mine.

and sorry, dont troll guys on me….

Wise
on July 13, 2016

So you have a script and you don’t know what things do? 
Man, you need to learn the basics first!

on July 13, 2016

wow thanks for the help

Guru
on July 13, 2016

A warning is not the same as an error. When you have an error your game won’t work when you have a warning it most likely will so probably for now just go with the jointdrivemode

on July 14, 2016

thank you

Show more replies
  • Liked by
Reply
Cancel
0 on April 5, 2018

The documentation say everything, JointDriveMode are now useless. But now PositionDamper work fine, maybe you can try something with it.

“JointDriveMode flags are now obsolete, and thus have been removed.”

If you want to see by yourself : https://docs.unity3d.com/Manual/UpgradeGuide53.html

  • Liked by
Reply
Cancel