vendredi 8 janvier 2016

Networking : day 3 : torque

After moving forward, next step is to rotate on 2 axis (I choosed 2 for more convenient, I don't like roll :p).

As seen before, the keyboard input are given on client side, and the physics is managed on server side.
So the input must be treated on remote, and the modification value done on server.

First, create input in project settings : using QD and ZS.













Next, we will in pawn blueprint, create an addTorque server event (custom event), running on server, with a vector in input.



 Now we can react at leftright event, and calculate the vector to apply torque



Notice the switch has autority... It is keyboard input, so we have to use remote activity.
 And now, we have to apply torque server side



I think switch has authority is not necessary here, it is more convenient to show example...

Finally, we will catch updown event, to pitch the spaceship


 Done...

For now, you can speed up to go forward, apply torque to turn right/left, or up/down.

Because you are using physics, reaction on bouncing, will be quite realistics

Aucun commentaire:

Enregistrer un commentaire