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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -