Smooth Model movement/rotation, ACS *.bin decompile

Ask about editing graphics, sounds, models, music, etc here!
Shaders (GLSL) and SNDINFO questions also go here!
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Smooth Model movement/rotation, ACS *.bin decompile

Postby Cherno » Sat Dec 15, 2018 4:01 pm

Two related questions.

As we all know, when using models for actors, the monster movement code makes the whole thing look weird with all the teleporting and insta-snapping to new angles all the time. There has been talk about using invisible actors that are in turn followed (smoothly) by model-only actors, but no tutorial for this as I know of. The only thing I was able to find out is that Total Chaos uses a system like that.

Code: Select allExpand view
actor brute_ambush 30031


        var int user_displayTid;
   var int user_status;
   var int user_hasTether;
   var int user_seenPlayer;
         AITE A 1
         AITE A 1 A_JumpIf(user_hasTether == 1, "SpawnActive")
         AITE A 1 ACS_NamedExecuteAlways("TetherAi", 0, 0, 10, 0)
         AITE A 100
         AITE A 0 A_SetUserVar("user_hasTether", 1)
         AITE A 1 ACS_NamedExecuteAlways("AiSetStateFromTable", 0, user_displayTid, 1, 1)
         0001 ABCD 1 A_Look
         AITE A 0
         AITE A 1 ACS_NamedExecuteAlways("AiSetStateFromTable", 0, user_displayTid, 1, 1)
         AITE A 0 A_SetUserVar("user_seenPlayer", 1)
         //AITE A 0 A_PlaySound("ai/brute/see", CHAN_AUTO)

So, the model-only actor is spawned in this actor's spawn state, and all further states somehow make the model-only actor change it's state, too (lookup table?). I assume that each actor that has a tether like this also has to havev a unique TID set when spawning.

Unfortunately, I wasn't able to find the model-only acto code, and the ACS file is a *.bin (as opposed to a *.o) so I couldn't decompile it to see the code.

So, does anyone have experience with smooth model movement and rotation? Can anyone make sense from the way Total Chaos did it? Is there a way to decompile *.bin ACS files?

(I desperately need it for my Alone in the Dark TC :) )
User avatar
Joined: 06 Dec 2016

Re: Smooth Model movement/rotation, ACS *.bin decompile

Postby Apeirogon » Sun Dec 16, 2018 2:23 pm

Quaternions have one fatal flaw, they dont have much of a "how to turn things using quaternions for dummy" manuals in the internet.
I have a strange sense of humour
Joined: 12 Jun 2017

Re: Smooth Model movement/rotation, ACS *.bin decompile

Postby gramps » Sun Dec 16, 2018 3:00 pm

This thing Gutawer wrote really has a pretty nice simple API... part of the issue here, with no "private" or "public" it might not be obvious which stuff you're supposed to be using and which stuff is internal.

I think in a case like this you'd want one quaternion representing the new angle, and one representing the old angle, and lerp between them; and then use the function that decomposes the thing back into yaw, pitch and roll.

If lerping doesn't feel smooth enough, you could rework that bit to put an easing function ahead of the lerp by manipulating the "time" value, something like a waveshaper. This is a little hard to describe properly, but look at the difference between the red and blue line here between 0,0 and 1,1; the red line represents a lerp and the blue line represents an eased lerp.


You could also do this with sin or atan or a number of heavy things, or with the usual jerky cubic and co, but a low-order approximation of a sine like this should get you the most bang for your buck. I think. Unless regular sine is actually cheaper?
Joined: 18 Oct 2018

Re: Smooth Model movement/rotation, ACS *.bin decompile

Postby Nicholas Smallson » Sun Jan 06, 2019 1:07 am

I was just going to post a thread asking this very question, but a search led me here. Unfortunately, the solution seems inconclusive. Does Gutawer have an example mod or tutorial that shows how these so called Quaternions work?
Nicholas Smallson

Return to Assets (and other stuff)

Who is online

Users browsing this forum: No registered users and 1 guest