Hi, having a issue with the rope anchors.
EDIT: Let me add what I’m trying todo is, connecting the player which is a ball with a box via rope, so that the player can pull the box around…
Inside my createRope()
The _object[0] is this: contactNode = result.getNode() which comes from another method i use to get the Line of sight to the “box” i want the rope to connect to from the player.
# PhysicsWorld info
info = self.player.game.physicsMgr.info
res = 8
p1 = Point3(_playerPos)
p2 = Point3(_object[1])
fixeds = 3
bodyNode = BulletSoftBodyNode.makeRope(info, p1, p2, res, fixeds)
bodyNode.setTotalMass(1.0)
bodyNP = self.player.game.physicsParentNode.attachNewNode(bodyNode)
self.player.game.physicsMgr.physicsWorld.attachSoftBody(bodyNode)
# Visualize the rope
geom = BulletHelper.makeGeomFromLinks(bodyNode)
visNode = GeomNode('')
visNode.addGeom(geom)
visNP = bodyNP.attachNewNode(visNode)
bodyNode.linkGeom(geom)
# Glue it
idx = bodyNode.getNumNodes() - 1
first = bodyNode.getClosestNodeIndex(p1, True)
last = bodyNode.getClosestNodeIndex(p2, True)
bodyNP.node().appendAnchor(first, _playerBody.node())
bodyNP.node().appendAnchor(last, _object[0])
So yeah I have tried a bunch of different things, and I can’t get it to work. I may have messed it up even more actually…
Thanks
MJ