Page 1 of 1

### Noesis Create NoeBone from Pos, Rot, Scl?

Posted: Fri Mar 29, 2019 4:42 am
I have a bone format that is stored as position, rotation, and scale as vectors. I'm looking over the NoeBone and NoeMat functions, but I don't see an clear way to create a NoeBone from these transformations.

Code: Select all

``````		self.bs.seek(self.header['boneOffset'], NOESEEK_ABS)
for i in range (0, self.header['boneCount']):

pos = NoeVec3([
])

rot = NoeVec3([
])

scl = NoeVec3([
])

# How to Generate NoeMat43?
``````

### Re: Noesis Create NoeBone from Pos, Rot, Scl?

Posted: Fri Mar 29, 2019 9:43 am
Just look in the python folder at the file inc_noesis.py
then find the starting data type like for instance
class NoeQuat
you can see it being initialized
quat = (0.0, 0.0, 0.0, 1.0)
and the option
toMat43
so you could do
myQuat = NoeQuat().toMat43()
then set the position with
myQuat[3] = [x,y,z]

### Re: Noesis Create NoeBone from Pos, Rot, Scl?

Posted: Sat Mar 30, 2019 4:41 am
Thanks for the reply. From reading through the source code, I was starting to suspect that was the expected approach. Suspicions confirmed, but the implementation turned out pretty simple.

Code: Select all

``````		self.bs.seek(self.header['boneOffset'], NOESEEK_ABS)
for i in range (0, self.header['boneCount']):

name = "bone_%03d" % id
parentName = "bone_%03d" % parentId

mat = rot.toMat43()
mat[3] = pos;
mat[0][0] = scl[0]
mat[1][1] = scl[1]
mat[2][2] = scl[2]

if i == 0:
bone = NoeBone(id, name, mat)
else:
bone = NoeBone(id, name, mat, parentName, parentId)
self.bones.append(bone)
``````
Looks like NoeAngle has the option to be converted into a NoeMat43 as well, so from there it's just a matter of setting the position and scale.