麻烦各位会JS和C#的大神,帮忙帮把js转一下C#,谢谢了
varCorrespondingCollider:WheelCollider;varSlipPrefab:GameObject;privatevarRotationVal...
var CorrespondingCollider : WheelCollider;
var SlipPrefab : GameObject;
private var RotationValue : float = 0.0;
function FixedUpdate () {
var hit : RaycastHit;
var ColliderCenterPoint : Vector3 = CorrespondingCollider.transform.TransformPoint( CorrespondingCollider.center );
if ( Physics.Raycast( ColliderCenterPoint, -CorrespondingCollider.transform.up, hit, CorrespondingCollider.suspensionDistance + CorrespondingCollider.radius ) ) {
transform.position = hit.point + (CorrespondingCollider.transform.up * CorrespondingCollider.radius);
}else{
transform.position = ColliderCenterPoint - (CorrespondingCollider.transform.up * CorrespondingCollider.suspensionDistance);
}
transform.rotation = CorrespondingCollider.transform.rotation * Quaternion.Euler( RotationValue, CorrespondingCollider.steerAngle, 0 );
RotationValue += CorrespondingCollider.rpm * ( 360/60 ) * Time.deltaTime;
var CorrespondingGroundHit : WheelHit;
CorrespondingCollider.GetGroundHit( CorrespondingGroundHit );
if ( Mathf.Abs( CorrespondingGroundHit.sidewaysSlip ) > 2.0 ) {
if ( SlipPrefab ) {
Instantiate( SlipPrefab, CorrespondingGroundHit.point, Quaternion.identity );
}
}
} 展开
var SlipPrefab : GameObject;
private var RotationValue : float = 0.0;
function FixedUpdate () {
var hit : RaycastHit;
var ColliderCenterPoint : Vector3 = CorrespondingCollider.transform.TransformPoint( CorrespondingCollider.center );
if ( Physics.Raycast( ColliderCenterPoint, -CorrespondingCollider.transform.up, hit, CorrespondingCollider.suspensionDistance + CorrespondingCollider.radius ) ) {
transform.position = hit.point + (CorrespondingCollider.transform.up * CorrespondingCollider.radius);
}else{
transform.position = ColliderCenterPoint - (CorrespondingCollider.transform.up * CorrespondingCollider.suspensionDistance);
}
transform.rotation = CorrespondingCollider.transform.rotation * Quaternion.Euler( RotationValue, CorrespondingCollider.steerAngle, 0 );
RotationValue += CorrespondingCollider.rpm * ( 360/60 ) * Time.deltaTime;
var CorrespondingGroundHit : WheelHit;
CorrespondingCollider.GetGroundHit( CorrespondingGroundHit );
if ( Mathf.Abs( CorrespondingGroundHit.sidewaysSlip ) > 2.0 ) {
if ( SlipPrefab ) {
Instantiate( SlipPrefab, CorrespondingGroundHit.point, Quaternion.identity );
}
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询