ios - SCNNode static body with .dae causing issues -
i have built landscape model in blender, exported .dae , added xcode project.
i have loaded scene attached child (landscape grid mesh) landscapenode, loads perfectly.
however when attach static physics body landscspenode heronode seems crash invisible wall when attempting fly above land.
the functionality looking obvious collision land have modelled heronode cannot fly through land , forced move around it.
note: did not converting of y axis in blender nor xcode rotated node 90degrees -x axis.
edit: code i've attempted add physics shape
landscapenode.physicsbody = [scnphysicsbody bodywithtype:scnphysicsbodytypestatic shape:[scnphysicsshape shapewithnode: [landscapescene.rootnode childnodewithname:@"grid" recursively:no] options:@{scnphysicsshapetypekey:scnphysicsshapetypeconcavepolyhedron}]]; landscapenode.physicsbody = [scnphysicsbody bodywithtype:scnphysicsbodytypestatic shape:[scnphysicsshape shapewithnode: landscapenode options:@{scnphysicsshapetypekey:scnphysicsshapetypeconcavepolyhedron}]]; landscapenode.physicsbody = [scnphysicsbody bodywithtype:scnphysicsbodytypestatic shape:[scnphysicsshape shapewithgeometry: landscapenode.geometry options:@{scnphysicsshapetypekey:scnphysicsshapetypeconcavepolyhedron}]];
if don't specify additional options when creating physics body node, convex hull encompassing node's geometry.
because landscape static body, can make use concave shape more closely approximates geometry. (note works static bodies.) this, you'll need to:
- use
bodywithshape:type:
method create body, notstaticbody
. - for method need pass
scnphysicsshape
. create 1shapewithgeometry:options:
orshapewithnode:options:
. - for options parameter, pass dictionary containing key
scnphysicsshapetypekey
, corresponding valuescnphysicsshapetypeconcavepolyhedron
.
Comments
Post a Comment