Stream<Object>
因此,我希望我的JavaRDD parsedData = data.map( o -> o.toString() )
.map( s ->
{
String[] sarray = s.split( " " );
double[] values = new double [sarray.length];
for( int i = 0; i < sarray.length; i++ )
{
values[i] = Double.parseDouble( sarray[i] );
}
return Vectors.dense( values );
});
parsedData.cache();
向 BackCube.position = cameraEye.position - cameraEye.forward * 2;
float back = cameraEye.position.z - 2f;
BackCube.position = new Vector3(BackCube.position.x, BackCube.position.y, back);
var lookPosBack = cameraEye.position - BackCube.position;
lookPosBack.y = 0;
var rotationBack = Quaternion.LookRotation(lookPosBack);
BackCube.rotation = Quaternion.Slerp(BackCube.rotation, rotationBack, 1);
的前向矢量旋转。上面的代码着眼于BackCube
,而不着眼于cameraEye
的前向向量。我希望彼此指向的正向向量彼此相距2个单位。我只能控制cameraEye
答案 0 :(得分:0)
这有效!
Vector3 direction = Vector3.ProjectOnPlane(cameraEye.forward, Vector3.up);
BackCube.transform.position = cameraEye.position - direction.normalized * 2;
var lookPosBack = cameraEye.position - BackCube.position;
lookPosBack.y = 0;
var rotationBack = Quaternion.LookRotation(lookPosBack);
BackCube.rotation = Quaternion.Slerp(BackCube.rotation, rotationBack, 1);