Page 1 of 1
Request for chest party animation format
Posted: Mon Mar 30, 2015 10:55 pm
by AdrTru
Hi all,
Do known somebody how is structure for animations for chest components? ( used node )
open = "assets/animations/env/treasure_chest_open.fbx"
close = "assets/animations/env/treasure_chest_close.fbx"
I need use simmilar effect, but for smaller distance.
Thx for reply.
Re: Request for animation format
Posted: Tue Mar 31, 2015 2:37 am
by minmay
Re: Request for animation format
Posted: Tue Mar 31, 2015 5:57 am
by AdrTru
Sorry for my bad description. This link I known.
I mean used node for party animation during chest effect.
Re: Request for chest party animation format
Posted: Tue Mar 31, 2015 7:06 am
by minmay
You mean the camera animation? I think that's hardcoded in ChestComponent and is just done by modifying the party's transformation matrix (check it with party:getWorldRotation()). I certainly can't find anything in the animation files, and the camera animation still happens with different custom animations. If you want to imitate it, you can use party:getWorldRotation() to obtain the a transformation matrix. It's just an ordinary 4x4 transformation matrix with 4 fields named x,y,z,w that are each arrays with 4 elements. So for example, to set an object's transformation matrix to be rotated pi/2 radians on the X axis from rest position, you would do:
Code: Select all
local mat = object:getWorldRotation()
local angle = pi/2
local sin = math.sin(angle)
local cos = math.cos(angle)
mat.x[1] = 1
mat.x[2] = 0
mat.x[3] = 0
mat.y[1] = 0
mat.y[2] = cos
mat.y[3] = sin
mat.z[1] = 0
mat.z[2] = -sin
mat.z[3] = cos
object:setWorldRotation(mat)
The table returned by getWorldRotation() seems to be a copy, and setWorldRotation() seems to copy its argument, so there is no need to copy them manually if you're using them for several purposes. Of course, in actual usage, you will want to multiply with the existing matrix (and generalize a lot more), this is just an example.
Also, the game will immediately overwrite any change you make to the party's transformation matrix as far as I can tell, so you want to make a new object with a CameraComponent and transform that instead.