Request for chest party animation format

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
User avatar
AdrTru
Posts: 223
Joined: Sat Jan 19, 2013 10:10 pm
Location: Trutnov, Czech Republic

Request for chest party animation format

Post 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.
Last edited by AdrTru on Tue Mar 31, 2015 6:13 am, edited 1 time in total.
My LOG2 projects: virtual money, Forge recipes, liquid potions and
MultiAlcoveManager, Toolbox, Graphic text,
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Request for animation format

Post by minmay »

Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
User avatar
AdrTru
Posts: 223
Joined: Sat Jan 19, 2013 10:10 pm
Location: Trutnov, Czech Republic

Re: Request for animation format

Post by AdrTru »

Sorry for my bad description. This link I known.
I mean used node for party animation during chest effect.
My LOG2 projects: virtual money, Forge recipes, liquid potions and
MultiAlcoveManager, Toolbox, Graphic text,
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Request for chest party animation format

Post 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.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Post Reply