这可以使用默认的Xcode 3D游戏模板(SpaceShip)复制。
删除在GameViewController中旋转飞船的runAction行。
添加此行。船正确地背对摄像机。 请注意at:参数中非常小的x分量。
ship.look(at:SCNVector3(0.001,0,-100.0),up:SCNVector3(0,1,0),localFront:SCNVector3(0,0,1))//有效!将面孔从相机上移开。
但是,如果at:参数的x分量恰好为零,则船的方向不变。船继续面对摄像机,而不是背对摄像机。
ship.look(at:SCNVector3(0,0,-100.0),up:SCNVector3(0,1,0),localFront:SCNVector3(0,0,1))//不起作用
使用simdLook()看到相同的问题
答案 0 :(得分:0)
对于初学者来说,如果您显示世界原点var height = jQuery('.navbar-default').offset().top;
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if(scroll>height) {
$('.navbar-default').css({position: 'fixed', top: '0px',left:'0px',right:'0px','z-index':'9999999999999999'});
} else if(scroll<height){
// below i want to right code to position navbar to its original position
$('.navbar-default').css({position: 'relative', top: height,left:'0px',right:'0px','z-index':'9999999999999999'});
}
});
,您将看到sceneView.debugOptions = ARSCNDebugOptions.showWorldOrigin]
和x
轴实际上与通常的轴相反,即{{1} }现在为y
,而x
现在为y
。
第二,您要更改y
轴而不是x
轴。如果您想让太空飞船视线或看着您,那将沿x
轴运行。负(-)z会看着您,而正(+)z会远离您。尝试仅将z
更改为z
。