[ad_1]
So, this could be a SceneKit/iOS drawback — nevertheless it would possibly as an alternative be a Blender drawback. This query presupposes the previous.
For example I open a contemporary challenge in Blender (nothing fancy) and export the default dice it creates as a dae file. I then import that dae file into my Xcode SceneKit challenge.
This specific SceneKit challenge consists of a scene by which a small ball rolls round on the highest floor of a dice.
The issue: If I exploit SceneKit’s built-in SCNBox form for the dice (with a static, convexHull physics physique), the ball rolls easily, as desired. But when I exploit the mannequin exported from Blender, the ball bounces alongside the dice’s floor as if it had been lined in small, invisible bumps.
What I’ve tried:
- I attempted rising the ball’s mass from 2.0 to 100.0 simply to see if that may have an effect on the result.
- I attempted making use of some smoothing modifiers to the mannequin in Blender in hopes that it will be freed from imperfections.
- I attempted changing the
daefile to SceneKit’s personalscnfile. - I attempted configuring the
SCNPhysicsShape‘schoicesparameter in numerous methods, together with the usage of.scale,.sort,.collisionMargin, and.keepAsCompound. Instance:
let form = SCNPhysicsShape(node: dice, choices: [.scale: cube.scale, .collisionMargin: 0.1])
- I attempted altering the
frictionandrestitutionof each the dice and ball. Much less friction/restitution didn’t clear up the issue, nor did extra of it. - I attempted disabling steady collision detection by eradicating the ball’s
continuousCollisionDetectionThreshold.
I am unsure how the next code will assist diagnose this drawback, however right here it’s anyway:
//Create the dice's physics physique:
let form = SCNPhysicsShape(node: dice)
dice.physicsBody = SCNPhysicsBody(sort: .static, form: form)
dice.physicsBody?.categoryBitMask = CollisionTypes.ground.rawValue
dice.physicsBody?.collisionBitMask = CollisionTypes.dynamicObjects.rawValue
dice.physicsBody?.contactTestBitMask = CollisionTypes.nothing.rawValue
dice.physicsBody?.isAffectedByGravity = false
dice.physicsBody?.allowsResting = false
dice.physicsBody?.restitution = 0.5
dice.physicsBody?.friction = 0.75
//Create the ball's physics physique:
let ballGeo = SCNSphere(radius: 0.5)
ballNode?.physicsBody = SCNPhysicsBody(
sort: .dynamic,
form: SCNPhysicsShape(
geometry: ballGeo
)
)
ballNode?.physicsBody?.categoryBitMask = CollisionTypes.dynamicObjects.rawValue
ballNode?.physicsBody?.contactTestBitMask = CollisionTypes.staticObjects.rawValue
ballNode?.physicsBody?.collisionBitMask = CollisionTypes.staticObjects.rawValue | CollisionTypes.ground.rawValue
ballNode?.physicsBody?.allowsResting = false
ballNode?.physicsBody?.continuousCollisionDetectionThreshold = 0.9 //Tried it with and with out this property.
ballNode?.physicsBody?.restitution = 0.5
ballNode?.physicsBody?.cost = 4.0
ballNode?.physicsBody?.friction = 0.2
ballNode?.physicsBody?.rollingFriction = 1.0
ballNode?.physicsBody?.angularDamping = 0.4
ballNode?.physicsBody?.mass = 2.0
Query: Why would possibly this drawback be occurring? Is it a SceneKit drawback, as this query presupposes — or is it a Blender drawback about which I might want to submit a query on one other discussion board?
Thanks to your assist.
[ad_2]
