BSG Editor(Enchantment Table)[Independent Tool][.Net Framework 4.0]

#24
Ok it seems to work now. I did still have to unblock the process in windows task manager and relog before it would work but it seems OK now. Could this be because it is an .exe without an installer?
 

ITR

l̺̤͈̘̰̺͉̳͉̖̝̱̻̠̦͈ͅ֍̫̜̥̭͖̱̟̟͉͙̜̰ͅl̺̤͈̘̰̺͉̳͉̖̝̱̻̠̦͈ͅ
Staff member
#26
Could be that your computer wants to be super secure or something
 
#27
the rotating code is here :p cannot fix that ekbruligas
Code:
Dim a = _存档L.世界旋转 / 2 'yaw (the angle of world rotation)
        Dim b = 0 / 2 'pitch
        Dim c = 0 / 2 'roll
        Dim CosineYaw = Math.Cos(a)
        Dim CosinePitch = Math.Cos(b)
        Dim CosineRoll = Math.Cos(c)
        Dim SineYaw = Math.Sin(a)
        Dim SinePitch = Math.Sin(b)
        Dim SineRoll = Math.Sin(c)

        Dim QuaternionW = CosineYaw * CosinePitch * CosineRoll + SineYaw * SinePitch * SineRoll
        Dim QuaternionX = CosineYaw * SinePitch * CosineRoll + SineYaw * CosinePitch * SineRoll
        Dim QuaternionY = SineYaw * CosinePitch * CosineRoll - CosineYaw * SinePitch * SineRoll
        Dim QuaternionZ = CosineYaw * CosinePitch * SineRoll - SineYaw * SinePitch * CosineRoll

        For i001 As Integer = 0 To _存档L.模块s.Count - 1
            Dim 模块L As 模块Class = _存档L.模块s(i001)
            '_存档L.世界旋转 = 0 '临时

            Dim QuaternionOriginalX = 模块L.四元旋转坐标.X 'i
            Dim QuaternionOriginalY = 模块L.四元旋转坐标.Y 'j
            Dim QuaternionOriginalZ = 模块L.四元旋转坐标.Z 'k
            Dim QuaternionOriginalW = 模块L.四元旋转坐标.W 'r

            模块L.四元旋转坐标 = New 坐标B('wxyz (also rijk)
               QuaternionW * QuaternionOriginalW - QuaternionX * QuaternionOriginalX - QuaternionY * QuaternionOriginalY - QuaternionZ * QuaternionOriginalZ,
               QuaternionW * QuaternionOriginalX + QuaternionX * QuaternionOriginalW + QuaternionY * QuaternionOriginalZ - QuaternionZ * QuaternionOriginalY,
               QuaternionW * QuaternionOriginalY - QuaternionX * QuaternionOriginalZ + QuaternionY * QuaternionOriginalW + QuaternionZ * QuaternionOriginalX,
               QuaternionW * QuaternionOriginalZ + QuaternionX * QuaternionOriginalY - QuaternionY * QuaternionOriginalX + QuaternionZ * QuaternionOriginalW
            )

            Dim vz = 模块L._坐标._Roll
            Dim vy = 模块L._坐标._Yaw
            Dim vx = 模块L._坐标._Pitch

            'qr
            Dim Quaternion2x = QuaternionX + QuaternionX
            Dim Quaternion2y = QuaternionY + QuaternionY
            Dim Quaternion2z = QuaternionZ + QuaternionZ

            Dim qr2i = QuaternionW * Quaternion2x
            Dim qr2j = QuaternionW * Quaternion2y
            Dim qr2k = QuaternionW * Quaternion2z
            'qi
            Dim qi2i = QuaternionX * Quaternion2x
            Dim qi2j = QuaternionX * Quaternion2y
            Dim qi2k = QuaternionX * Quaternion2z
            'qj
            Dim qj2j = QuaternionY * Quaternion2y
            Dim qj2k = QuaternionY * Quaternion2z
            'qk
            Dim qk2k = QuaternionZ * Quaternion2z

            模块L.坐标 = New 坐标A(
                vx * (qi2k - qr2j) + vy * (qj2k + qr2i) + vz * (1 - qi2i - qj2j),'X position
            vx * (qi2j + qr2k) + vy * (1 - qi2i - qk2k) + vz * (qj2k - qr2i),'Y position
            vx * (1 - qj2j - qk2k) + vy * (qi2j - qr2k) + vz * (qi2k + qr2j)'Z position
            )


            模块L.坐标 = New 坐标A(
                                 模块L.坐标.Roll + _存档L.世界坐标.Roll - 起始方块位置._Roll, 'X final position
                                 模块L.坐标.Yaw + _存档L.世界坐标.Yaw - 起始方块位置._Yaw,'Y final position
                                 模块L.坐标.Pitch + _存档L.世界坐标._Pitch - 起始方块位置._Pitch'Z final position
                                 ) '估计作者写错了所以pitch和roll搞反了’
changed a little bit of the code
result : (0° 45° 90°)



Import AQ-9 to 1id and generated 1aq

Attached Files
1id.bsg
AQ-9.bsg
1aq.bsg
 

ITR

l̺̤͈̘̰̺͉̳͉̖̝̱̻̠̦͈ͅ֍̫̜̥̭͖̱̟̟͉͙̜̰ͅl̺̤͈̘̰̺͉̳͉̖̝̱̻̠̦͈ͅ
Staff member
#28
All theeze chineze textz
 
#30
I just see the Chinese characters as boxes, apparently I don't have the right fonts installed. But the exact variable names aren't important and the rest is clear enough.

I went through the code and compared it directly to my own and found no errors in the math. From the input angles to the output objects, it seems like the formulas are doing what they are supposed to do.

What happens when you test it on a simple bsg file? What does the output look like? Also if you set the yaw/pitch/roll input angles to zero, is the output bsg file identical to the source bsg?
 
#32
Well, that is... interesting to look at. Note that the angles must be given in radians, not in degrees. A quick check confirms that sqrt(r²+i²+j²+k²)=1 for all of the rotation parameters in the output bsg, which means they're all valid unit quaternions. And in the game, all blocks are oriented the right way relative to each other. We're almost there! The rotation itself seems to work, it's just the positions that are acting strange.

Wait a minute, in the part that rotates the position vectors you define
Code:
Dim vx = 模块L._坐标._Pitch
calling x the Pitch axis, but in the output x is taking the Roll variable.
Code:
 模块L.坐标 = New 坐标A(
    模块L.坐标.Roll + _存档L.世界坐标.Roll - 起始方块位置._Roll, 'X final position
(I hope the Chinese characters were copied correctly.) Could that be it, use radians instead of degrees, and the x and z axes got mixed up?
 

ITR

l̺̤͈̘̰̺͉̳͉̖̝̱̻̠̦͈ͅ֍̫̜̥̭͖̱̟̟͉͙̜̰ͅl̺̤͈̘̰̺͉̳͉̖̝̱̻̠̦͈ͅ
Staff member
#40
This mod is for the previous .bsg file system, so I believe it currently won't work
 
Top