Photon Unity Networking 2  v2.1
English | 日本語 | 한국
Public Member Functions | Public Attributes | List of all members
PhotonTransformViewClassic Class Reference

This class helps you to synchronize position, rotation and scale of a GameObject. It also gives you many different options to make the synchronized values appear smooth, even when the data is only send a couple of times per second. Simply add the component to your GameObject and make sure that the PhotonTransformViewClassic is added to the list of observed components More...

Inherits MonoBehaviour, and IPunObservable.

Public Member Functions

void SetSynchronizedValues (Vector3 speed, float turnSpeed)
 These values are synchronized to the remote objects if the interpolation mode or the extrapolation mode SynchronizeValues is used. Your movement script should pass on the current speed (in units/second) and turning speed (in angles/second) so the remote object can use them to predict the objects movement. More...
 
void OnPhotonSerializeView (PhotonStream stream, PhotonMessageInfo info)
 スクリプトがPhotonViewの同期データを読み書きできるように、PUNによって1秒間に数回呼び出されます。 More...
 

Public Attributes

PhotonTransformViewPositionModel m_PositionModel = new PhotonTransformViewPositionModel()
 
PhotonTransformViewRotationModel m_RotationModel = new PhotonTransformViewRotationModel()
 
PhotonTransformViewScaleModel m_ScaleModel = new PhotonTransformViewScaleModel()
 

Detailed Description

This class helps you to synchronize position, rotation and scale of a GameObject. It also gives you many different options to make the synchronized values appear smooth, even when the data is only send a couple of times per second. Simply add the component to your GameObject and make sure that the PhotonTransformViewClassic is added to the list of observed components

Member Function Documentation

void OnPhotonSerializeView ( PhotonStream  stream,
PhotonMessageInfo  info 
)

スクリプトがPhotonViewの同期データを読み書きできるように、PUNによって1秒間に数回呼び出されます。

このメソッドは、PhotonViewのObservedコンポーネントとして割り当てられているスクリプトで呼び出されます。
PhotonNetwork.SerializationRateは、このメソッドが呼び出される頻度に影響します。
PhotonNetwork.SendRateは、このクライアントによってパッケージが送信される頻度に影響します。

このメソッドを実装すると、PhotonViewがどのデータを定期的に同期するかをカスタマイズできます。 あなたのコードは何が送られているか(内容)とあなたのデータが受信クライアントによってどのように使われるかを定義します。

他のコールバックとは異なり、OnPhotonSerializeViewは、PhotonView.observedスクリプトとして PhotonViewに割り当てられている場合にのみ呼び出されます。

このメソッドを利用するには、PhotonStreamが不可欠です。 PhotonView(PhotonStream.IsWriting == true)を制御するクライアントでは「書き込み」モードになり、制御クライアントが送信したものを受信するだけの リモートクライアントでは「読み取りモード」になります。

ストリームへの値の書き込みをスキップすると、PUNは更新をスキップします。 慎重に使用すれば帯域幅とメッセージを節約できます(ルーム/秒ごとに制限があります)。

送信者が更新を送信しない場合、OnPhotonSerializeViewはリモートクライアントでは 呼び出されません。これは「1秒あたりのx回Update()」としては使用できません。

Implements IPunObservable.

void SetSynchronizedValues ( Vector3  speed,
float  turnSpeed 
)

These values are synchronized to the remote objects if the interpolation mode or the extrapolation mode SynchronizeValues is used. Your movement script should pass on the current speed (in units/second) and turning speed (in angles/second) so the remote object can use them to predict the objects movement.

Parameters
speedThe current movement vector of the object in units/second.
turnSpeedThe current turn speed of the object in angles/second.