SceneKit Steering

时间:2015-05-12 18:13:07

标签: ios scenekit

如何让我的节点始终朝着它面向的方向前进?

float tilt = _motionManager.accelerometerData.acceleration.x;
[_player runAction:[SCNAction rotateByX:0 y:-tilt * 0.03 z:0 duration:_dt]];
//Make SCNAction to moveBy X and Z in the direction _player is facing.

有没有办法找出SCNVector3在1点以外朝着_player面向的方向?

1 个答案:

答案 0 :(得分:1)

获取播放机前的位置。

SCNVector3 pos = [_scene.rootNode convertPosition:SCNVector3Make(0, 0, -1) fromNode:_player];