[Closed] Using Fracture nodes
Hi!
I’m using a Fracture helper in MaxScript and I need to change all the Fracture’s pieces to unbreakable.
This code:
F = Fracture()
[...adding pieces...]
fractPieces = F.pieces()
for i=1 to F.getNumPieces() do (setPieceType fractPieces[i] #unbreakable)
is not working ofc. Everytime it says ‘Call needs function or class, got: #($Box:car…’.
How can I use the Fracture nodes?
I think setPieceType is a method of Fracture, so the following (untested) should work.
F = Fracture()
[...adding pieces...]
fractPieces = F.pieces()
for i=1 to F.getNumPieces() do (F.setPieceType fractPieces[i] #unbreakable)
editted to add:
It’s probably better to say…
for p in fractPieces do (F.setPieceType p #unbreakable)
Cheers,
Drea
Still the same: ‘Call needs function or class, got: #($Box: car @ [0,0,0])’.
The problem may be those coords, but I’m not sure…
Hmm, I don’t think the coordinates make any difference.
How are you adding the pieces?
car = Box()
F.addPiece car
It’s not the point I think – the nodes are correct or else it would return error (and the first added piece was a box named car so it seems to be ok).
Ah, just spotted it.
In the line “fractPieces = F.pieces()”, pieces is a property of fracture, not a method . Try removing the parentheses.