The big .thn/.lua research thread
-
@Treewyrm Bit late but I’m finally requesting edit access. I’ve started doing menu screens again and figured it would be good to note down what I figure out/remember as I go. I have a few bits on sparam ready to go already, so I’ll add those when you approve it.
-
So, I’m having a very minor issue with my START_MOTION entry:
{ 0, START_MOTION, { "lpi_sugarland_mplatform_1" }, { animation="Sc_rotate living quarters", duration=3600, time_scale=1, weight=1, heading=-1, event_flags=2 } },
The animation (the rotating part for [c]manufacturing_platform_lod.cmp[/c] ) ‘jumps’ inconsistently every now and then. As it’s just a simple rotating part, and it loops for the entire duration of the scene, I’m not really sure what to do to get it fixed. This is the first time I’ve really played with START_MOTION in a scene. Any ideas?
-
How animation plays out depends on several factors. If animation script contains maps for more than one part and each map has different durations the animation will go out of sync as each part will have its animation looped independently. Type of looping is defined by event_flags property (restart, reverse, ping-pong, etc).
-
I assume event_flags=2 is restart. I’ve played around with it and have seen the animation reverse and play once, but it won’t loop smoothly.
You can see the behavior demonstrated here (Around 00:26):
-
Quite frankly I just don’t see what’s wrong there, probably because whatever is supposed to be incorrect is just too far and youtube quality makes it all kinda hard to spot anyway.
Either way it’s all about how map keyframes are set and whether they are looped or not. Some vanilla models have that and for full 360 rotation they have to make a quick jump as maximum rotation between two keyframes is 180 degrees. This jump can become noticable if there’s time delta between its keyframes.
-
Found a fix! Jeider on the Freelancer Discord provided some alternate keyframes for [c]manufacturing_platform_lod.cmp[/c] and that fixed the issue.
For anyone running into a similar problem in the future, they can be found below:
0 0 2 2 4 4 6 0
https://media.discordapp.net/attachments/638985274122174464/692105622124101762/unknown.png
-
That’s kinda stupid. For a revolute part (which quarters_lod1 is) the values that go there are pairs of timestamp (in seconds) and rotation angle (in radians). The ones you list are going to create partial spin back and forth rather than continious one.
Assuming you want to do full 360 spin in 10 seconds the solution is:
0.0 <- Frame 1 timestamp: 0 seconds
0.0 <- Frame 1 value: 0 degrees
5.0 <- Frame 2 timestamp: 5 seconds
3.14159 <- Frame 2 value: 180 degrees
5.0 <- Frame 3 timestamp: 5 seconds
-3.14159 <- Frame 3 value: -180 degrees
10.0 <- Frame 4 timestamp: 10 seconds
0.0 <- Frame 4 value: 0 degreesNotice the doubled keyframe at half duration, a flip occurs there to continue rotation into a loop.
Flip signs at values of mid-keyframes if you want to rotate the other direction. Naturally your Rev part must have min/max angles set to -360 and 360 degrees respectively.
-
That’s kinda stupid.
Because this is my solution. Yes, I did that many times ago and this (by strange reason) really working.
Anyway - your solution isn’t best.
This is best solution:
0 -6,283185 20 6,283185 ```Don't forget about set Frames = 2 By strange reason my version working only with 6,xx values. With 3,xx values this doen't work.
-
Does anyone have a better guide to the lightprops section handy?
I’ve been working off the guide but i’m having trouble working out what does what, and in what format. From a lot of my own testing it appears [c]cutoff[/c] and [c]range[/c] don’t seem to do anything (but apparently they do?) and I don’t really have much of a handle on how any of the parameters should look/be adjusted aside from [c]diffuse[/c] which is fortunately quite obvious.
The end goal is to use the [c]date()[/c] function to adjust the relevant parameters based on the time and parse them into the lightprops table so it’s fairly easy to create working day/night scripts for planets. I’m just not sure what to adjust!
If anyone could help out I’d really appreciate it.
-
Just jumping back to answer my own question for reference! Callum in the Librelancer Discord server kindly provided a structure that lightprops in thorn scenes seems to follow. It can be found here:
https://docs.microsoft.com/en-us/windows/win32/direct3d9/d3dlight9