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

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -