i have infinitely scrolling background , character 'walking' on ground plane.
i want drop objects above , have them land on ground - far good. objects don't move ground.
can't find examples taken care of.
my 'ground' edge @ correct height regard graphics background.
let edge = sknode() edge.physicsbody = skphysicsbody(edgefrompoint: cgpointzero, topoint: cgpointmake(self.frame.width + 1, 0)) edge.position = cgpointmake(0, bottomshelf_itemstartposition.y) self.addchild(edge)
i've tried giving ground sksritenode physical properties, didn't make difference.
what best approach this? must simple way make moving ground effect objects.
adding scroll routine:
func backgroudscrollupdate1(){ back.position = cgpoint(x: back.position.x - scrollperframeamount, y: back.position.y) back2.position = cgpoint(x: back2.position.x - scrollperframeamount, y: back2.position.y) if (back.position.x < -(back.size.width / 2)) { back.position = cgpointmake(back2.position.x + back.size.width, back.position.y) } if (back2.position.x < -(back.size.width / 2)) { back2.position = cgpointmake(back.position.x + back2.size.width, back2.position.y) }
}
update - progress
i have set physics world, ground infinitely scrolling. i've got items fall out of 'sky' , land on ground. can move things around applying impulse directly or 1 thing hitting another.
but, expected scrolling ground 'pull' things along if on ground?
i have played around different friction levels of both ground @ items touching ground, doesn't seem matter.
one thing did sort of work if set phsyics body of item circle, ground influence item, turning around in opposite direction of scrolling - when hits edge stops, rather spinning @ edge.
if part working, why wouldn't rectangle dragged along ground ?
would love see example code of phsyics world have ground effecting other nodes..
Comments
Post a Comment