ios - Scenekit PhysicEngine follow rolling ball -


i want follow rotating sphere in apple's scenekit. i've added lookat constraint camera , sphere falls down cam aleays points if sphere rolls away camera stays @ current position. want cam follow sphere in third persond shooter predefined distance it. if make cam childnode of sphere cam "orbits" around ball rolling. ideas how can follow ball cam?

it's pretty simple. need change camera node's position @ each frame ball's presentationnode plus offset avoid being inside of it.

i'm not familiar swift code this:

func renderer(arenderer: scnscenerenderer, didsimulatephysicsattime time: nstimeinterval){     var ballp = ballnode.presentationnode.position     // offset camera , on x:     var camerap = scnvector3(x: ballp.x+5, y: ballp.y+10, z: ballp.z)     cameranode.position = camerap        } 

Comments

Popular posts from this blog

gcc - MinGW's ld cannot perform PE operations on non PE output file -

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

c# - Search and Add Comment with OpenXML for Word -